Excel VBA Application - Card Reader RRS feed

  • Question

  • I have a rather simple application with one form. All the code is contained within the Excel workbook file and in standard VBA Modules.  The Macro Settings are set to Enable All Macros. I want to allow the user to copy the Excel file from a lower folder to the folder above, open the Excel file and select an "Open GC Form" menu selection to add "records" to a spreadsheet. I get an error message "Cannot run the Macro "macro name" The macro may not be available in this workbook..." which it is.

    When I perform the same steps in my development directories it works just fine.

    Any suggestions, please?

    Additionally: the Macro is trying to open from the original development directory.
    Monday, August 29, 2016 4:24 PM

All replies

  • Hi,

    How do you call the macro in the VBA application? What' s the specific code?

    Are you calling/running the macro in a standard VBA Module from a form? Are the module and the form in the same file or separated? 

    What do you mean "the Macro is trying to open from the original development directory", do you mean when calling the macro after you move the file, it actually run the macro in the original document?

    I could succeed in run the macro no matter where the file is by using Application.Run "Book1.xlsm!test" or Call test

    "test" is a macro name in the Module1

    Sub test()

    MsgBox ("test")

    End Sub

    What's your steps to call the macro? Since we couldn’t reproduce your issue, please share more detail information with us.

    Tuesday, August 30, 2016 7:58 AM
  • Celese,

    I call my subroutine from a custom menu selection on the workbook;


    in a module named 'Module1'

    the code is as follows;

    Public Sub OpenGCForm()


    End Sub

    I'll recreate my custom menu selection as you suggest; "SVdP Gift Cards.xlsm!OpenGCForm"

    Tuesday, August 30, 2016 1:14 PM
  • Actually the "ThisWorkbook." is not in the subroutine, it will generate an error so please disregard.

    It does read;


    Public Sub OpenGCForm()


    End Sub

    Sorry for any confusion I may have caused.

    Tuesday, August 30, 2016 2:39 PM