pdavis
07-02-2007, 11:18 AM
I am trying to set up a form in word which will allow users to chose whether certain text should be included (depending on variables). I have the beginning set up but in trying to test, I cannot get the macro to insert text.
I have created a separate word document that includes all of the text to be inserted (and nothing else).
The code I have is:
Sub GetAnAnswer()
Set objVar = Word.Application
MsgBox "Is this being sent to a special provider (i.e. radiologist or MRI)?", vbYesNo
Response = GetYesNo((Prompt))
End Sub
Function GetYesNo(Message)
If MsgBox(Message.vbYesNo) = vbYes Then
GetYesNo = True
Else
GetYesNo = False
End If
If GetYesNo = True Then
Selection.InsertFile ("I:\MRI Additions.doc")
End If
End Function
I continue getting the "Object required" error and have tried multiple ways to set my documents but have gotten nowhere.
Any suggestions?
I have created a separate word document that includes all of the text to be inserted (and nothing else).
The code I have is:
Sub GetAnAnswer()
Set objVar = Word.Application
MsgBox "Is this being sent to a special provider (i.e. radiologist or MRI)?", vbYesNo
Response = GetYesNo((Prompt))
End Sub
Function GetYesNo(Message)
If MsgBox(Message.vbYesNo) = vbYes Then
GetYesNo = True
Else
GetYesNo = False
End If
If GetYesNo = True Then
Selection.InsertFile ("I:\MRI Additions.doc")
End If
End Function
I continue getting the "Object required" error and have tried multiple ways to set my documents but have gotten nowhere.
Any suggestions?