My goal is to have a COM component that can launch a PDF document. So in a
project, I have a form, called frmMain, with a textbox called
txtTransmission on it, and I have this subroutine:
Public Sub LaunchAdobeHelp(ByVal strFile As String)
Dim frm As New frmMain
AppActivate Shell("C:\AcroRd32.exe", vbNormalFocus)
frm.txtTransmission.LinkTopic = "acroview|control"
frm.txtTransmission.LinkMode = vbLinkManual
frm.txtTransmission.LinkExecute "[DocOpen(""" & strFile & """)]"
End Sub
If I compile this as a standard EXE, in a module with a Sub Main like:
Public Sub main()
LaunchAdobeHelp "C:\mydoc.pdf"
End Sub
....then Adobe Acrobat will launch, and will open the proper document.
However, if I compile it as an ActiveX Library (in a class module called
"Adobe"), and in another project write:
Public Sub main()
Dim al As New Adobe
al.LaunchAdobeHelp "C:\mydoc.pdf"
Set al = Nothing
End Sub
....Adobe Acrobat will launch, but will NOT open the document. How can I
fix this?