+ Reply to Thread
Results 1 to 8 of 8

Need a macro that opens another workbook but stays in current workbook

  1. #1
    Registered User
    Join Date
    04-25-2015
    Location
    Pointe au Baril, ON
    MS-Off Ver
    2013
    Posts
    11

    Need a macro that opens another workbook but stays in current workbook

    Hi!

    I'm new to macros and VBA, so I apologize for missing the obvious. The first workbook, containing the macro, is the sales template. It draws customer data from a table in another workbook. I want the user to be able to click a button from the first workbook that runs a macro that will open the customer workbook and continue to save the template (first workbook) as a file with the current date. I can do these separately, but not together. Once the customer file opens, Excel doesn't return to the macro. I don't know how to fix this. Any help is greatly appreciated.

    P.S. Here is the code, and I hope I've tagged it properly.

    Sue

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,596

    Re: Need a macro that opens another workbook but stays in current workbook

    Go back with:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-25-2015
    Location
    Pointe au Baril, ON
    MS-Off Ver
    2013
    Posts
    11

    Re: Need a macro that opens another workbook but stays in current workbook

    Thank you so much for the speedy reply. I added the suggested line just after the 'Workbooks.Open' but I still get runtime error 9, subscript out of range. Any ideas?

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Need a macro that opens another workbook but stays in current workbook

    How about

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    04-25-2015
    Location
    Pointe au Baril, ON
    MS-Off Ver
    2013
    Posts
    11

    Re: Need a macro that opens another workbook but stays in current workbook

    Thank you for the suggestion. I tried shg's code but this still returns the subscript out of range error. I tried recording a macro that would toggle back to the original workbook, right after opening the customer file:

    Please Login or Register  to view this content.
    I no longer get the error but it doesn't actually put the first workbook on the screen. It does continue to perform the rest of the macro. My workaround is to tell the user to minimize the customer file. Oh well.

    Thank you both for responding so quickly. I very much appreciate it!

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Need a macro that opens another workbook but stays in current workbook

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-25-2015
    Location
    Pointe au Baril, ON
    MS-Off Ver
    2013
    Posts
    11

    Re: Need a macro that opens another workbook but stays in current workbook

    Thanks, shg, for hanging in there with me. It's working now. I'm sure I'll be back posting new threads as I continue on this learning journey!

    Thank you very much. (I don't know what to do to mark this solved, though.)

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Need a macro that opens another workbook but stays in current workbook

    You're welcome.

    Quote Originally Posted by shoes1 View Post
    (I don't know what to do to mark this solved, though.)
    You could read the forum rules

+ 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 can i execute a macro in current workbook after another workbook opens?
    By sds1126 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-12-2014, 09:36 AM
  2. Replies: 3
    Last Post: 07-12-2014, 06:04 AM
  3. Replies: 1
    Last Post: 03-10-2014, 05:20 AM
  4. How to open,save and close another workbook from the current workbook using macro?
    By ravikumar00008 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-15-2012, 10:42 AM
  5. A button that opens a new workbook and saves the current worksheet on to it
    By shilpz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-15-2008, 02:50 AM

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