Hi,
I'm new too access VBA and this may be easy. I'm using Access 2010 and I have a form with a button that opens up a Word document using the code below. The code also has a message box that pops up on the form that asks the user if they want to save the prior document version before making changes to it. I would like to know if there is a way to have the message box pop up in the Word Document after it opens instead of on the form. Not sure if this can be done. Any help would be greatly appreciated.
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim filepath As String
Dim lngValue As Long
Set wrdApp = CreateObject("Word.Application")
filepath = Me.Preface
Set wrdDoc = wrdApp.Documents.Open(filepath)
lngValue = MsgBox("Would you like to save the prior version before making any changes? Y/N", vbYesNo + vbQuestion, "Save Prior Version")
If lngValue = vbYes Then
wrdApp.ActiveDocument.SaveAs2 "\\jbxsw\Plans\Preface Prior Version.docx"
Else
End If
wrdApp.Visible = True
Set wrdApp = Nothing
I'm new too access VBA and this may be easy. I'm using Access 2010 and I have a form with a button that opens up a Word document using the code below. The code also has a message box that pops up on the form that asks the user if they want to save the prior document version before making changes to it. I would like to know if there is a way to have the message box pop up in the Word Document after it opens instead of on the form. Not sure if this can be done. Any help would be greatly appreciated.
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim filepath As String
Dim lngValue As Long
Set wrdApp = CreateObject("Word.Application")
filepath = Me.Preface
Set wrdDoc = wrdApp.Documents.Open(filepath)
lngValue = MsgBox("Would you like to save the prior version before making any changes? Y/N", vbYesNo + vbQuestion, "Save Prior Version")
If lngValue = vbYes Then
wrdApp.ActiveDocument.SaveAs2 "\\jbxsw\Plans\Preface Prior Version.docx"
Else
End If
wrdApp.Visible = True
Set wrdApp = Nothing