Command button on form to open excell or word doc

  • Thread starter Thread starter joe
  • Start date Start date
J

joe

Hello,

Is it possible to place a command button on the form which
if the user clicks, they are able to enter notes or any
additional information on a blank word doc or excell sheet?
This is needed since the user must record certain
incidents on these formats as a reference to what is
entered into the database for that day.

Thanks
 
In the click event put the following -(this one is for Word -for Excel
change the Object to "Excel.Application"

Private Sub cmdWord_Click()
On Error GoTo Err_cmdWord_Click
Dim oApp As Object
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
Exit_cmdWord_Click:
Exit Sub
Err_cmdWord_Click:
MsgBox Err.Description
Resume Exit_cmdWord_Click
End Sub

HTH
Damon
 
Oh yeah, for other apps, use (like this one for Notepad)
Private Sub cmdNotes_Click()
On Error GoTo Err_cmdNotes_Click
Dim stAppName As String
stAppName = "C:\Some Directory\notepad.exe"
Call Shell(stAppName, 1)
Exit_cmdNotes_Click:
Exit Sub
Err_cmdNotes_Click:
MsgBox Err.Description
Resume Exit_cmdNotes_Click
End Sub

HTH
Damon
 
Back
Top