+ Reply to Thread
Results 1 to 2 of 2

Copy from Workbook to Workbook - BUT I don't have name of 2nd book

  1. #1
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2010
    Posts
    278

    Copy from Workbook to Workbook - BUT I don't have name of 2nd book

    Hi, is it possible to copy data from one workbook to another if you don't know the name of the 2nd workbook?
    Scenario:
    Wb1 - New workbook has vba code to copy from Old Wb2, but I do not have name of old book. I would have both open at the time.

    I don't know the name because it resides inside a third-party application which defines the name. Also, this would be used on multiple different files with different names, but the guts of the workbook are the same. (Clear as mud?)

    Anyway, bottom line is workbook to workbook, without a name. Somehow I would have to ensure that only those 2 workbooks are open. The Old workbook would have a named range that is the same as the new workbook.

    Thank you.

  2. #2
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Copy from Workbook to Workbook - BUT I don't have name of 2nd book

    Hello Ker9,

    use the following code to determine the second workbook - which will be set as '"wb'' - then you can use code to copy between '"wb.Sheets(x).Range...'" etc and '"ThisWorkbook.Sheets(x).Range...'" etc.

    Please Login or Register  to view this content.
    Please click the * below if this helps
    Please click the * below if this helps

  3. #3
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2010
    Posts
    278

    Re: Copy from Workbook to Workbook - BUT I don't have name of 2nd book

    Hi, it's a good start, the problem is with hidden workbooks.
    Please Login or Register  to view this content.
    I have two hidden (Personal.xls and Personal.xlsb) and so might my users. The users might also be totally unaware that there are hidden workbooks open.

    I just found some great code that lets me capture the names of all the open workbooks:

    Please Login or Register  to view this content.
    But I haven't yet figured out what to do with it.
    I might be able to ask them which one to use. Unfortunately, they may not know since it will have an alphanumeric naming scheme that makes no sense.
    Last edited by ker9; 10-03-2013 at 02:16 PM.

+ 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. [SOLVED] Copy Data From Another Workbook thats in the same folder as the openwork book
    By jed38 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-20-2013, 12:30 PM
  2. Copy Desired data from one work book to another workbook
    By R_Abhilash in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-19-2013, 02:11 AM
  3. Replies: 2
    Last Post: 07-18-2012, 08:21 AM
  4. Copy a worksheet as a new workbook with sheet and book name from a list
    By simondon in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-31-2011, 10:52 AM
  5. Replies: 9
    Last Post: 01-23-2011, 05:31 PM

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