I have documents being stored in an OLE Object on a database and I want to do it so that when you click on a button that document will load.
So far I have got......
Private Sub Command50_Click()
On Error GoTo Err_Command50_Click
' Button launches Word and opens a specified document
' And runs an optional macro. the macro could print out the word doc and quit
Dim retval As Variant
Dim DocName, MacroName As String
' Drive and Full path to name and location of Word document
DocName = "F:\Somefolder\MyDoc.doc"
'Note full path to Word including Drive and folder
retval = Shell("c:\Program Files\Office\WinWord.exe" & " " & DocName & MacroName, vbNormalFocus)
Exit_Command50_Click:
Exit Sub
Err_Command50_Click:
MsgBox Err.Description
Resume Exit_Command50_Click
End Sub
But I need to change the coding of....
DocName = "F:\Somefolder\MyDoc.doc"
So that it will always open the document that is in the OLE Source at that time.
Can anyone help?
So far I have got......
Private Sub Command50_Click()
On Error GoTo Err_Command50_Click
' Button launches Word and opens a specified document
' And runs an optional macro. the macro could print out the word doc and quit
Dim retval As Variant
Dim DocName, MacroName As String
' Drive and Full path to name and location of Word document
DocName = "F:\Somefolder\MyDoc.doc"
'Note full path to Word including Drive and folder
retval = Shell("c:\Program Files\Office\WinWord.exe" & " " & DocName & MacroName, vbNormalFocus)
Exit_Command50_Click:
Exit Sub
Err_Command50_Click:
MsgBox Err.Description
Resume Exit_Command50_Click
End Sub
But I need to change the coding of....
DocName = "F:\Somefolder\MyDoc.doc"
So that it will always open the document that is in the OLE Source at that time.
Can anyone help?