+ Reply to Thread
Results 1 to 8 of 8

Runing a macro into another workbook

  1. #1
    Registered User
    Join Date
    01-04-2010
    Location
    Amsterdam, Netherland
    MS-Off Ver
    Excel 2003
    Posts
    43

    Runing a macro into another workbook

    I'd like to build a macro in a workbook ( A) which does:

    1) Open another workbook ( B)
    2) Update some cells in (B) which are the parameters for a macro already built in (B) , called "get data" (Parameter one-> the path, parameter two -> name of the file with data)
    3) Run the macro in (B) which upload the data in a spreadsheet of (B),
    4) Save B and close it.

    If I open B and update manually the parameters ( specific cells in the first page ) and run the macro "Get data", it works perfectly.
    But if I call this macro from another workbook , it gives me "error messages".

    --------------------------------------------------------------------------------------------------------------
    Dim RTMWB As Workbook
    RTMPath = \\aaaaaaaaaa\Wrokbook(B).xlsb
    Set RTMWB = Workbooks.Open(RTMPath, ignorereadonlyrecomanded = True) ..... "The RTMWB opens correctly

    Application.Run (RTMWB!loadRDEToSheet)

    With RTMWB
    .SaveAs Filename:=OutputPath & SavingWBName & "_" & Period & "_" & Run & ".xlsb"
    .Close
    End With

    ------------------------------------------------------------------------------------------------------------

    When it is supposed to run the "application.run" I get the error message "runtime error 438 . Object or methond doesn't suport this property"

    I'm afraid that I'm wrong in the sintax of the Aplication.Run .

    I'd really apreciate your help.
    Last edited by Sokol; 03-28-2024 at 07:38 PM. Reason: Not the right explanation

  2. #2
    Valued Forum Contributor
    Join Date
    12-30-2020
    Location
    Odessa / Ukraine
    MS-Off Ver
    2021
    Posts
    301

    Re: Runing a macro into another workbook

    Hi @Sokol.
    Try to remove the parameters ", ignorereadonlyrecomanded = True" when you open the workbook RTMWB.
    NOTE: As the original poster/owner, only you can mark your thread as SOLVED (Thread Tools above Post #1).
    You can say "Thanks" in your thread to everyone who offered to help you.
    You can also reward them by clicking * "Add Reputation" under their username on the left.
    With Regards, MikeVol.

  3. #3
    Registered User
    Join Date
    01-04-2010
    Location
    Amsterdam, Netherland
    MS-Off Ver
    Excel 2003
    Posts
    43

    Re: Runing a macro into another workbook

    Nop... Tried.. but the same result.

    Thank you for your sugestion.

  4. #4
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,223

    Re: Runing a macro into another workbook

    Try
    Please Login or Register  to view this content.
    Artik

  5. #5
    Valued Forum Contributor
    Join Date
    11-29-2022
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    430

    Re: Runing a macro into another workbook

    Quote Originally Posted by Artik View Post
    Try
    Please Login or Register  to view this content.
    Artik
    This. The parameter for Run takes a string, not an object, so you have to pull the name from it.

  6. #6
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,223

    Re: Runing a macro into another workbook

    I don't think I was wrong. I take the name of the object and pass it as part of the parameter.

    Artik

  7. #7
    Registered User
    Join Date
    01-04-2010
    Location
    Amsterdam, Netherland
    MS-Off Ver
    Excel 2003
    Posts
    43

    Re: Runing a macro into another workbook

    Yes.. it works perfectly

    Thank you very much !

  8. #8
    Registered User
    Join Date
    01-04-2010
    Location
    Amsterdam, Netherland
    MS-Off Ver
    Excel 2003
    Posts
    43

    Re: Runing a macro into another workbook

    yes.. it works perfectly

    Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. how macro to keep runing while system is locked
    By prabhuduraraj09 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2019, 09:16 AM
  2. Checking the workbook before runing content of macro
    By dlangschied in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-25-2015, 04:07 PM
  3. [SOLVED] Msbox for runing or not runing a macro.
    By apla in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-27-2013, 12:26 PM
  4. opening a VBA file and runing its macro
    By Zealotwraith in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-30-2013, 11:20 AM
  5. [SOLVED] runing macro depending on day
    By thesnake505 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-10-2013, 05:40 PM
  6. Replies: 0
    Last Post: 01-13-2006, 02:30 AM
  7. Runing part of the macro
    By michal in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-17-2005, 01:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1