+ Reply to Thread
Results 1 to 7 of 7

vba to change macro file name

  1. #1
    Registered User
    Join Date
    10-26-2006
    Posts
    38

    replace macro info

    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?

  2. #2
    Registered User
    Join Date
    10-26-2006
    Posts
    38

    vba to change macro file name

    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.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524
    I don't know how deep you know about coding...

    Application.GetOpenFileName function will suite your case.

  4. #4
    Registered User
    Join Date
    10-26-2006
    Posts
    38
    unfortunately i know very little..still learning. so i'm not actually sure what you mean by Application.GetOpenFileName function

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524
    Post your current code.

  6. #6
    Registered User
    Join Date
    10-26-2006
    Posts
    38
    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
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524
    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
    Please Login or Register  to view this content.
    But I don't know if this fits in your case.
    Last edited by jindon; 12-02-2007 at 12:16 AM.

+ 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