+ Reply to Thread
Results 1 to 7 of 7

Compile Error: Ambiguous Name Detected: Workbook_Open

  1. #1
    Forum Contributor
    Join Date
    09-19-2004
    Location
    Canada
    Posts
    408

    Question Compile Error: Ambiguous Name Detected: Workbook_Open

    Hi all,

    I have the following two codes, which go in ThisWorkbook module:

    Please Login or Register  to view this content.
    and

    Please Login or Register  to view this content.
    The first code forces the user to enable macros, and the second code tracks the opening and closing of the workbook. The Tracking Log worksheet is "xlSheetVeryHidden" and the TestFile workbook is hidden.

    How do I put them in the same ThisWorkbook module without getting the "Ambiguous name detected: Workbook_open" error?

    Thank you,
    Gos-C
    Using Excel 2010 & Windows 10
    "It is better to be prepared for an opportunity and not have one than to have an opportunity and not be prepared."

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You need to place your code in Standard modules & call them from the Open event
    Hope that helps.

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

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    09-19-2004
    Location
    Canada
    Posts
    408
    Thank you for replying, royUK.

    I placed the codes in standard modules. How do I call them?

    Thanks,
    Gos-C

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Replace macro1 7 macro2 with the names that you have given your new macros

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    09-19-2004
    Location
    Canada
    Posts
    408
    Hi royUK,

    Thanks again for your guidance.

    After several tries, I finally got it to work. I kept everything in ThisWorkbook, called the TrackOpen code, and declared some undeclared variables.

    Can you please review and advise if everything, especially those in red letters, is okay.

    Here is the code:

    Please Login or Register  to view this content.
    I appreciate you help.

    Thank you,
    Gos-C

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I wouldn't place the non workbook code in the workbook module, but in a separate module.

    Please Login or Register  to view this content.
    Then in the workbook module

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    09-19-2004
    Location
    Canada
    Posts
    408
    Hi royUK,

    I added the following to the standard module:

    Please Login or Register  to view this content.
    and added:

    Call TrackClose after the Call HideAllSheets line in the workbook module, and everything works fine.

    Thanks for your help.

    Gos-C

+ 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