+ Reply to Thread
Results 1 to 11 of 11

Saving as stops macro working

  1. #1
    Forum Contributor
    Join Date
    02-05-2008
    Posts
    116

    Saving as stops macro working

    hi

    Im wondering if there is an easy way around a problem i have with my worksheet. i have a worksheet named for example 'allocation 1' this is a master document and is opened and modified and 'saved as' under a customer name. This then stops a few important macros working properly because they refer to the original title and not the new saved title. Is there any code that will let the macro recognise any new title it is saved under?

    Many Thanks

    Denzil

  2. #2
    Forum Contributor
    Join Date
    04-21-2007
    Location
    Lima, Peru
    MS-Off Ver
    2000, 2007, 2010
    Posts
    674

    Macros not working

    Hi Denzil

    Where necessary any references to the workbook name should be replaced with "Activeworkbook" then all macros should function normally.

    Regards

    Jeff

  3. #3
    Forum Contributor
    Join Date
    02-05-2008
    Posts
    116
    Hi Jeff

    Im not sure whats goin wrong but if I add "activeworkbook" in the macros where the original name was and resave, the macro still doesnt work on debug the code stops at that same line where i put your text in, Is there something i am doing wrong or could the problem be elsewhere?

    Many thanks for your help

    Denzil

  4. #4
    Forum Contributor
    Join Date
    02-05-2008
    Posts
    116
    -----bump-----

  5. #5
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Is it the Workbook that is being renamed or a Worksheet within the Workbook

    Posting a copy of your macro code may also help in obtaining a better answer to your problem
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  6. #6
    Forum Contributor
    Join Date
    02-05-2008
    Posts
    116

    Smile

    Sorry for the delay!!

    Hope someone can still help

    Its the Workbork name that gets saved as a different name, the name the macros work under is only the master copy of the document (Par 2 Auto Spec & Allocation 04.06.07side), all other copies get saved under a totally different name, Is there any way around this? Its the "FINISHED SPEC" Button that will not work once the document has been "saved as".

    Many Thanks

    Denzil
    Attached Files Attached Files
    Last edited by Denzil; 02-28-2008 at 07:58 AM.

  7. #7
    Forum Contributor
    Join Date
    02-05-2008
    Posts
    116
    .............bump..........

  8. #8
    Forum Expert
    Join Date
    09-09-2005
    Location
    England
    MS-Off Ver
    2007
    Posts
    1,500
    You have included a workbook with 14 modules in it. It helps you have given us a workbook, but it would be more helpful to describe what exactly does not work. Which macro it involves, rather than expecting us to try everything until something does not work.

    If you are a little more descriptive, with the error or problem I am sure you will get an answer

    Regards

    Dav

  9. #9
    Forum Contributor
    Join Date
    02-05-2008
    Posts
    116
    Hi Dav

    Thanks for your reply

    I see what your saying, I thought Id mentioned the button which uses the macro that does not work. Its the "Finished Spec Button" and the code is:
    PHP Code: 
    Sub Macro2()
    '
    Macro2 Macro
    ' Macro recorded 09/01/2008 by
    '

    '
        Sheets("Allocation").Select
        Application.Run "'
    Par 2 Auto Spec Allocation 04.06.07side.xls'!test"
    End Sub 
    I Know its the "Par 2 Auto Spec & Allocation 04.06.07side.xls" Line but Im not sure what text to put in its place that could mean something more universal so it does not need that as the saved title for the macro to work.

    Any Ideas?

    Many Thanks

    Denzil

  10. #10
    Forum Expert
    Join Date
    09-09-2005
    Location
    England
    MS-Off Ver
    2007
    Posts
    1,500
    Well I would change the test macro to make it select the sheet allocation. If you are allready on this sheet, it just reselects the current sheet, so the code will still run fine.

    Please Login or Register  to view this content.
    then I would assign the test macro to the button instead of macro2. Macro2 can even be deleted, as all it is doing is duplicating code

    Does that help?

    Regards

    Dav

  11. #11
    Forum Contributor
    Join Date
    02-05-2008
    Posts
    116

    Talking

    Hi Dav

    Very Simple And very effective!!

    Works exactly how I want it to

    Thanks for your help, much appreciated!!

+ 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