Hi Art
You can get very sophisticated with something like this. For example, if the
file does not open, you can give the user different messages depending on
the reason the file didn't open (eg the file didn't exist, InfoPath wasn't
installed), but this should get you going.
STEP 1: At the top of your module, before any other Subs or Functions, paste
the following:
Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal HWnd As Long, _
ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
STEP 2: Now, paste this anywhere in your module:
Sub OpenMyInfoPathFile()
Dim lngResult As Long
Dim sPFN As String
'Change the following to your file and path name
sPFN = "D:\D\test\Form1.xml"
lngResult = ShellExecute(0&, "open", sPFN, vbNullString, vbNullString,
vbNormalFocus)
If lngResult > 32 Then
'cool!
Else
MsgBox "Could not open this InfoPath file"
End If
End Sub
STEP 3: Finally, attach the OpenMyInfoPathFile to your button.
Hope this helps.
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word