Dozingquinn
asked on
Converting Macro to VBA? Can you convert back?
Hello,
I created a macro using the Access GUI, but then I wanted to add some extra code. So I selected the option 'Convert Macros to Visual Basic'. This was great as it allowed me to add some extra code snippets. But in the process it converted my macro into a module.
1) Am I able to convert this module back to a macro?
2) Can I run module's like macros?
I created a macro using the Access GUI, but then I wanted to add some extra code. So I selected the option 'Convert Macros to Visual Basic'. This was great as it allowed me to add some extra code snippets. But in the process it converted my macro into a module.
1) Am I able to convert this module back to a macro?
2) Can I run module's like macros?
I wouldn't worry about converting a module to a macro. Yes you can. What exactly is the code you are using to call the macro/module?
ASKER
Hi Emil,
Below is the code snippet. The reason that I ask whether I can convert the module back to a macro, is because I don't know how to use (or run) modules. I only converted the macro to Visual Basic code so I could add in some more parameters that weren't visible in the Access Macro GUI.
Is there a way to look into the VB code of a macro without converting it into a module?
Below is the code snippet. The reason that I ask whether I can convert the module back to a macro, is because I don't know how to use (or run) modules. I only converted the macro to Visual Basic code so I could add in some more parameters that weren't visible in the Access Macro GUI.
Is there a way to look into the VB code of a macro without converting it into a module?
'------------------------------------------------------------
' mac_excel_patient_export
'
'-
Function mac_excel_patient_export()
On Error GoTo mac_excel_patient_export_Err
DoCmd.TransferSpreadsheet acExport, 10, "qry_excel_patient", "C:\data.xls", True, "Patientsheet"
DoCmd.TransferSpreadsheet acExport, 10, "qry_excel_treatment", "C:\data.xls", True, "Treatmentsheet"
mac_excel_patient_export_Exit:
Exit Function
mac_excel_patient_export_Err:
MsgBox Error$
Resume mac_excel_patient_export_Exit
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Emil. I ended up attaching the 'basic' version of the macro to a button - then I viewed the code of the macro and ended up making the alterations there. It was a kind of 'the long way around' but it worked.