+ Reply to Thread
Results 1 to 3 of 3

moving between workbooks

  1. #1
    Registered User
    Join Date
    12-23-2007
    Posts
    47

    moving between workbooks

    I am trying to copy data from one workbook to a new workbook. However, only know the name of the second workbook as people might change the name of the first workbook.

    How do you reference workbooks so that you can move back and forth between them.

    I thought it was
    Please Login or Register  to view this content.
    or Select
    Last edited by VBA Noob; 07-16-2008 at 04:08 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello dgkindy,

    You can assign object variables to each workbook. This example assumes the second workbook is the new one the data will be copied to and the VBA macro is in the first workbook.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    08-10-2007
    Posts
    51
    In addition to Leith's response,

    To reference workbooks by name instead, reference them by stating:

    Workbooks("abc.xls").activate

    That will activate abc.xls for example. To get to it, you could save the variable name as a string and refer to it whenever you need to.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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