Welcome to the Excel Forum

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Please Register to Remove these Ads

Please Register to Remove these Ads



Reply
  #1  
Old 11-20-2008, 07:33 PM
dsb1958 dsb1958 is offline
Registered User
 
Join Date: 19 Nov 2008
Location: West Sussex, England
Posts: 3
dsb1958 is becoming part of the community
Adding a variable

Please Register to Remove these Ads

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
Reply With Quote
  #2  
Old 11-20-2008, 09:04 PM
rylo rylo is offline
Forum Moderator
 
Join Date: 15 Jan 2007
Location: Brisbane, Australia
MS Office Version:2003
Posts: 4,096
rylo is very confident of their ability rylo is very confident of their ability rylo is very confident of their ability rylo is very confident of their ability
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
Reply With Quote
  #3  
Old 11-25-2008, 06:40 PM
dsb1958 dsb1958 is offline
Registered User
 
Join Date: 19 Nov 2008
Location: West Sussex, England
Posts: 3
dsb1958 is becoming part of the community
THanks I'll give it a go, and let you know
Reply With Quote


Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump