+ Reply to Thread
Results 1 to 4 of 4

How to import a closed workbook into an open one?

  1. #1
    Registered User
    Join Date
    07-13-2017
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    12

    Lightbulb How to import a closed workbook into an open one?

    Hi there everyone,

    I've spent a good length of time(more than I should have in all honesty) trying to find some code that works for me, yet it either fails or operates correctly then crashes.

    Simply put, im looking for some code that when the command button in the user form is pressed, it will import (has to be import as there's merged cells, loads of rows etc in the closed workbook so can't copy)
    The sheets into the current workbook.

    That's it really, just so when you press the button, the code will import a workbook from a specified path into the current workbook.

    I appreciate any assistance with this issue as it's currently hindering my progress on my project.

    All the best,

    Nathan

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,662

    Re: How to import a closed workbook into an open one?

    First, this doesn't make sense to me:
    Quote Originally Posted by nathan488 View Post
    has to be import as there's merged cells, loads of rows etc in the closed workbook so can't copy
    There is no such thing as "import" a workbook. If you copy the sheets, they will preserve merged cells and everything else.

    To copy sheets from a closed workbook, you have to open it. If the code is located in the same workbook that is to receive the sheets, you want something like this (untested though I would test if I had your files)

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    07-13-2017
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    12

    Re: How to import a closed workbook into an open one?

    Quote Originally Posted by 6StringJazzer View Post
    First, this doesn't make sense to me:There is no such thing as "import" a workbook. If you copy the sheets, they will preserve merged cells and everything else.

    To copy sheets from a closed workbook, you have to open it. If the code is located in the same workbook that is to receive the sheets, you want something like this (untested though I would test if I had your files)

    Please Login or Register  to view this content.
    It works perfectly thank you so much!

    My apologises about some of my statements made, I'm still fairly new to VBA, and trying my best to get a hold of it.

    Appreciate the help though (will add reputation to your profile)

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,662

    Re: How to import a closed workbook into an open one?

    You're welcome! Thanks for the rep, and thanks for marking your thread Solved!

+ 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. Import data from closed workbook
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-18-2015, 09:02 AM
  2. Replies: 0
    Last Post: 03-27-2014, 12:38 PM
  3. Import all sheets from closed workbook to the open workbook
    By HerryMarkowitz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-10-2013, 04:05 AM
  4. Open Workbook if closed, keep open if open, insert password
    By jwahl16 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-09-2013, 04:09 PM
  5. Import data from several closed workbooks to a single sheet in an open workbook
    By drewship in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-04-2013, 06:35 AM
  6. Macro to open a closed workbook and select copy cells into an open workbook
    By helloganesh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-10-2013, 02:00 PM
  7. Replies: 1
    Last Post: 11-26-2011, 09:10 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