+ Reply to Thread
Results 1 to 6 of 6

Open workbook as variable

  1. #1
    Registered User
    Join Date
    05-26-2010
    Location
    Kent
    MS-Off Ver
    Excel 2003
    Posts
    53

    Open workbook as variable

    Hi All

    I am trying to run a macro but want to use the name of the open workbook to declare a variable
    So in this case I want to replace ("BANK_Architect_Template.xls") with the open workbook name,


    "Set T_Site = Workbooks("BANK_Architect_Template.xls").Sheets("ReportControl").Range("A1")
    Dim TSite As String
    TSite = T_Site.Offset(4, 3).Value"

    Any help would be appricarted
    Thanks
    Karen
    Last edited by Karen311261; 01-29-2012 at 06:32 AM.

  2. #2
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Open workbook as variable

    Please Login or Register  to view this content.
    perhaps, assuming you wish to refer to whichever workbook is active.

    Also, please note the use of code tags which are required by forum rules.
    Good luck.

  3. #3
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Open workbook as variable

    Try

    Please Login or Register  to view this content.

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Open workbook as variable

    Karen311261
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  5. #5
    Registered User
    Join Date
    05-26-2010
    Location
    Kent
    MS-Off Ver
    Excel 2003
    Posts
    53

    Re: Open workbook as variable

    Thanks for help

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Open workbook as variable

    Hi Karen311261
    If you are satisfied with the solution(s) provided, please

    Go to the first post
    Click edit
    and add code tags #
    Click Save

+ 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