Hi! i'm trying to build a macro that will change the files a macro effects. For example
i have a macro that's doing things to testfile.xls but i want to run a macro that will allow a user to type a name in a cell, say "apple" and have a macro run that will go in and edit the macro that runs for testfile.xls and change the name to apple.xls so that macro will now run on the apple.xls file.
OR
Alternatively a macro or VBA that will run when the file with the macro's open that will have a box that will request to enter the name of the file i'm working on and when you click ok it will then change the file names on the macro's.
is this possible?
Hi! i'm trying to build a macro or some VBA that will change the files a macro effects. For example
a macro or VBA that will run when the file with the macro's opens that will have a box that will request the user to enter the name of the file they're working on, AND the name of a 2nd file they're working on.
when you click ok it will then change the file names on the macro's in the workbook so the macro's when run will put mods through on the new excel docs.
is this possible? make any sense?
also the macro sheet will be used multiple times so every time a user goes into the file with the macro's the name change box will need to be present and work regardless of what the previous user enters
Last edited by blackstar; 12-01-2007 at 11:32 PM.
I don't know how deep you know about coding...
Application.GetOpenFileName function will suite your case.
unfortunately i know very little..still learning. so i'm not actually sure what you mean by Application.GetOpenFileName function
Post your current code.
ok file attached is the macro's. what i'm looking for is. the person enters the 1st file name in the 1st file name box then enters the 2nd file name in the 2nd file name box. clicks setup and this will run a macro that will change all the file names for the macro's UN_A to UN_AZ from say testsheet.xls to another.xls so that when the UN macro's are run they'll put the changes through on the correct sheet (just a basic hide unhide but i don't have the info in those yet so they're all blank)
i need this to be able to run again and again for different file names though so can't be a one time change.
Hope all this makes sense
Sorry, I can not download any of the file attached.
Please wait for other to help you.
What I can suggest is, instead of InputBoxes
But I don't know if this fits in your case.Code:Dim file1 As String, file2 As String file1 = Application.GetOpenFileName() file2 = Application.GetOpenFileName()
Last edited by jindon; 12-02-2007 at 12:16 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks