+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    11-19-2008
    Location
    West Sussex, England
    Posts
    3

    Adding a variable

    I want to open in a macro workbooks with a different name and number, I would like to add a variable into that macro that I can type in before running the said macro. i.e. C:\temp\NorthSeaArea1.txt, the name variable will be the "NorthSeaArea" and the number variable will be the "1", this also can vary between 1 up to 7, when that is set then I could run the rest of the macro which copies 2 cells from one workbook to another.
    Can any body tell me what the solution is to this problem?
    Thanks for your help.
    DSB

  2. #2
    Forum Guru
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    5,015
    Hi

    Here's one way

    Code:
      Workbooks.Open Filename:="c:\temp\" & InputBox("What is the file name") & InputBox("What is the number") & ".txt"
    Another would be to use the
    Code:
    getname = Application.GetOpenFilename
    approach where the user can move to the relevant file.

    rylo

  3. #3
    Registered User
    Join Date
    11-19-2008
    Location
    West Sussex, England
    Posts
    3
    THanks I'll give it a go, and let you know

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.2.0