+ Reply to Thread
Results 1 to 9 of 9

macros deleted but code still present.

  1. #1
    Registered User
    Join Date
    11-04-2010
    Location
    Illinois
    MS-Off Ver
    Excel 2003, Excel 2010
    Posts
    86

    macros deleted but code still present.

    Sorry guys if my title was misleading but I had this spreadsheet that had many macros a predecessor of mine made that started when the workbook was opened. However, it had been awhile since the macro was used and when I went to open the spreadsheet again, the macro names were all gone but the code was still present! How did this happen and more importantly, how do I get my macro names back and get the code to work?
    Last edited by HP RodNuclear; 03-09-2011 at 02:27 PM.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: macros deleted but code still present.

    Not sure this makes sense, at least for me. If the macros are still present then the names are still present. Where do you expect to see these names that they aren't?
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    11-04-2010
    Location
    Illinois
    MS-Off Ver
    Excel 2003, Excel 2010
    Posts
    86

    Re: macros deleted but code still present.

    Well, when you go to Tools -> Macros, the macros name are not present for us to even run but when I alt + f11, the code is all still there. Tried to call the important macros at the end with no success.
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    11-04-2010
    Location
    Illinois
    MS-Off Ver
    Excel 2003, Excel 2010
    Posts
    86

    Re: macros deleted but code still present.

    It is alot of code but the two important pieces are the emergent code and the refreshdates code and I tried to call them at the end with no success. It gave me the debug error at the Call Emergent part. What is going on?

  5. #5
    Forum Contributor johnjohns's Avatar
    Join Date
    11-19-2007
    Location
    Dubai, UAE
    MS-Off Ver
    2003 and 2007
    Posts
    526

    Re: macros deleted but code still present.

    Tools->macros will show only those given in a module
    Last edited by johnjohns; 03-09-2011 at 09:00 AM.
    regards

    johnjohns

    When you are not sure where to go, every road takes you there!

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: macros deleted but code still present.

    The Workbook_Open code that you have posted is not viewable in the Macros list, it's event code & is automatically run when the workbook is opened with macros enabled.

    If the rest of the code is in that module then that will not show either, it needs to be in a Standard module
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  7. #7
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: macros deleted but code still present.

    The "other" subs won't ever show in the macro list because they have parameters. ie.
    Please Login or Register  to view this content.
    The only one that will show is this one:
    Please Login or Register  to view this content.
    The Workbook_Open() handler won't show because it has been given a Private scope.


    Edit:
    Also, you will get an error if you run the SuperMacro() because it calls Emergent and RefreshDates without passing the required arguments:
    Please Login or Register  to view this content.
    If these procedures all used to be visible and SuperMacro used to run without a problem, I would suggest that someone has been tinkering with the code (adding in parameters).
    Last edited by Colin Legg; 03-09-2011 at 09:49 AM.
    Hope that helps,

    Colin

    RAD Excel Blog

  8. #8
    Registered User
    Join Date
    11-04-2010
    Location
    Illinois
    MS-Off Ver
    Excel 2003, Excel 2010
    Posts
    86

    Re: macros deleted but code still present.

    I think I resolved the issue. I don't know what exactly changed but I just made the private workbook open function a public function and sort of resolved the issue from there. Thanks for all you guys help and I actually learned quite a bit just from you guys explanations and my own tinkering as well. As always you guys rock!

    -HP RodNuclear

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: macros deleted but code still present.

    You shouldn't change the Open_Workbook, what you need to do is move the rest of the code to a Standard Module

+ 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