jenvandiver
Registered User.
- Local time
- Today, 17:11
- Joined
- Oct 16, 2002
- Messages
- 56
I'm trying to code a button on a form in Access to open an Excel template. This is what I've got so far. It works as far as opening Excel, but it won't open the file.
Private Sub CreateCommentsMatrix_Click()
Dim lngRetval As Long
Dim oApp As Object
Dim strDoc As String
lngRetval = MsgBox("Please wait..." & vbCrLf & "", vbOKOnly + vbInformation + vbDefaultButton1, "Creating Comments Matrix")
Select Case lngRetval
Case vbOK
End Select
Set oApp = CreateObject("Excel.Application")
oApp.Visible = True
With oApp
Set strDoc = ("C:\Documents and Settings\vandiverj\AMTPT\Training Tool\Templates\Comments Matrix.xlt")
OpenDocument (strDoc)
If Err Then
Shell "C:\Program Files\Microsoft Office\Office\" & "Excel/Automation", vbMaximizedFocus
AppActivate "Microsoft Excel"
End If
Set oApp = Nothing
End With
End Sub
I appreciate the help! Thanks,
Private Sub CreateCommentsMatrix_Click()
Dim lngRetval As Long
Dim oApp As Object
Dim strDoc As String
lngRetval = MsgBox("Please wait..." & vbCrLf & "", vbOKOnly + vbInformation + vbDefaultButton1, "Creating Comments Matrix")
Select Case lngRetval
Case vbOK
End Select
Set oApp = CreateObject("Excel.Application")
oApp.Visible = True
With oApp
Set strDoc = ("C:\Documents and Settings\vandiverj\AMTPT\Training Tool\Templates\Comments Matrix.xlt")
OpenDocument (strDoc)
If Err Then
Shell "C:\Program Files\Microsoft Office\Office\" & "Excel/Automation", vbMaximizedFocus
AppActivate "Microsoft Excel"
End If
Set oApp = Nothing
End With
End Sub
I appreciate the help! Thanks,