Results 1 to 3 of 3

The macro may not be available in this workbook or all macros may be disabled.

This is a discussion on The macro may not be available in this workbook or all macros may be disabled. within the Excel Questions forums, part of the Question Forums category; I have this code placed in the ThisWorkbook: Code: Private Sub TimedMacro() 'This should be the macro that runs; we ...

  1. #1
    Board Regular
    Join Date
    Sep 2008
    Location
    Houston, tx
    Posts
    503

    Default The macro may not be available in this workbook or all macros may be disabled.

    I have this code placed in the ThisWorkbook:
    Code:
    Private Sub TimedMacro()
         
         'This should be the macro that runs; we simply show a message box
        MsgBox "Are you finished with the Sales Log? If so, please close it.", vbInformation
         
    End Sub
    Code:
    Private Sub Workbook_Open()
    'TimeSerial(hours, minutes, seconds)
        Application.OnTime Now + TimeSerial(0, 1, 0), "TimedMacro"
    End Sub

    What's worng with this? When the timed period arrives I get "Cannot run the macro "C:\Users\me\Desktop\SalesLog.xls'!TimedMacro'. The macro may not be available in this workbook or all macros may be disabled." instead of it showing the MsgBox??? Macros ARE enabled in the work book.

    Or if there is a better way to do this. I just want a nag reminder to pop up every five minutes. Thanks for any help.

  2. #2
    Board Regular
    Join Date
    Nov 2011
    Posts
    1,067

    Default Re: The macro may not be available in this workbook or all macros may be disabled.

    Try putting the

    Code:
    Private Sub TimedMacro()
         
         'This should be the macro that runs; we simply show a message box
        MsgBox "Are you finished with the Sales Log? If so, please close it.", vbInformation
         
    End Sub
    In its own module.

  3. #3
    Board Regular
    Join Date
    Sep 2008
    Location
    Houston, tx
    Posts
    503

    Default Re: The macro may not be available in this workbook or all macros may be disabled.

    Ah, thank you, that worked!

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


DMCA.com