L
LEU
In my document form I have a command button that pastes information into my
form. How would I add to my existing macro that if “c:\TempA.doc†does not
exist it would give a message that the file does not exist and then it
returns to the open form. Right now if “c:\TempA.doc†does not exist it gives
an error “5174†and stops the macro.
Private Sub CmdPaste1_Click()
Dim DocA As Document
Dim oFF As FormFields
Set DocA = Documents.Open("c:\TempA.doc")
Set oFF = ActiveDocument.FormFields
Me.Text3.Value = oFF("Text41").Result
Me.Text4.Value = oFF("Text27").Result
Me.Text5.Value = oFF("Text28").Result
‘AND SO ON
DocA.Close
Kill "c:\TempA.doc"
Set DocA = Nothing
Set oFF = Nothing
End Sub
form. How would I add to my existing macro that if “c:\TempA.doc†does not
exist it would give a message that the file does not exist and then it
returns to the open form. Right now if “c:\TempA.doc†does not exist it gives
an error “5174†and stops the macro.
Private Sub CmdPaste1_Click()
Dim DocA As Document
Dim oFF As FormFields
Set DocA = Documents.Open("c:\TempA.doc")
Set oFF = ActiveDocument.FormFields
Me.Text3.Value = oFF("Text41").Result
Me.Text4.Value = oFF("Text27").Result
Me.Text5.Value = oFF("Text28").Result
‘AND SO ON
DocA.Close
Kill "c:\TempA.doc"
Set DocA = Nothing
Set oFF = Nothing
End Sub