I'm new to the group, and haven't crafted a search intelligently enough to find what I'm looking for, and haven't the time to look at all of the threads in this forum.
Here's what I'm after: I save an Access report as an .RTF file, intend to copy a macro from Normal.DOT into it, and then run MS Word to open the document. Here's the code I have so far:
Public Function ExportTimesheet() As Boolean
Dim strReportOutput As String
strReportOutput = "C:\Share\Time Sheet.RTF"
docmd.OutputTo acOutputReport, "Time Sheet", acFormatRTF, strReportOutput, False
AttachMacro strReportOutput, "MyMacro"
Call Shell("WINWORD.EXE "/mMyMacro """ & strReportOutput & """", 1)
End Function
This all works fine, except that my sub AttachMacro() is still empty. I found a reference in VBA Help yesterday that had exactly what I wanted, but then I lost it, and have been combing the web and the Object Browser since trying to find the method or statement that will do the trick. All I remember is that it had as arguments 1) an acObjectType, 2) the object's name, 3) source file, 4) destination file, and possibly some optional arguments.
I really do not want to try to hand-code the RTF lines that will embed the macro. Any help would be greatly appreciated.
Don Newkirk
don.e.newkirk@odot.state.or.us
Here's what I'm after: I save an Access report as an .RTF file, intend to copy a macro from Normal.DOT into it, and then run MS Word to open the document. Here's the code I have so far:
Public Function ExportTimesheet() As Boolean
Dim strReportOutput As String
strReportOutput = "C:\Share\Time Sheet.RTF"
docmd.OutputTo acOutputReport, "Time Sheet", acFormatRTF, strReportOutput, False
AttachMacro strReportOutput, "MyMacro"
Call Shell("WINWORD.EXE "/mMyMacro """ & strReportOutput & """", 1)
End Function
This all works fine, except that my sub AttachMacro() is still empty. I found a reference in VBA Help yesterday that had exactly what I wanted, but then I lost it, and have been combing the web and the Object Browser since trying to find the method or statement that will do the trick. All I remember is that it had as arguments 1) an acObjectType, 2) the object's name, 3) source file, 4) destination file, and possibly some optional arguments.
I really do not want to try to hand-code the RTF lines that will embed the macro. Any help would be greatly appreciated.
Don Newkirk
don.e.newkirk@odot.state.or.us