pg11rahul_m
New Member
- Joined
- Jan 14, 2015
- Messages
- 14
Hi,
I have a Word macro enabled document with ActiveX controls in it. A user can basically select multiple check boxes or select options in combo boxes on the Word Form. There are certain fields that I want to make sure the user fills before closing the word document. Below piece of code addresses this requirement.
Now I have an excel VBA tool that creates a word object and using that object reads all the information that the user has filled in the Word form. Once all data is extracted I close the word form using below code:
Problem is when I use above code it pops up the reminder message (1st piece of code) again. I was trying to figure out a way to prevent this. Maybe I can access the VBA code in the word document and assign some values that will prevent this. But I'm not sure how I can do that. Any help will be much appreciated.
Thanks.
I have a Word macro enabled document with ActiveX controls in it. A user can basically select multiple check boxes or select options in combo boxes on the Word Form. There are certain fields that I want to make sure the user fills before closing the word document. Below piece of code addresses this requirement.
Code:
Option Explicit
Public WithEvents oApp As Word.Application
Private Sub oApp_DocumentBeforeClose(ByVal Doc As Document, Cancel As Boolean)
'Below code prompts a reminder message when user tries to close the form
Dim response As Integer
response = MsgBox("Reminder: Have you updated Total Number of Objections? ", vbYesNo)
If response = vbYes Then
Cancel = False
Else
Cancel = True
End If
End Sub
Now I have an excel VBA tool that creates a word object and using that object reads all the information that the user has filled in the Word form. Once all data is extracted I close the word form using below code:
Code:
wDoc.Close SaveChanges:=False
Problem is when I use above code it pops up the reminder message (1st piece of code) again. I was trying to figure out a way to prevent this. Maybe I can access the VBA code in the word document and assign some values that will prevent this. But I'm not sure how I can do that. Any help will be much appreciated.
Thanks.