B
bzamfir
Hi,
I have an application written in VFP (but this doesn't really mattter,
it could be in VBA too) which nmeeds to allow users to create some DOC
templates for mailmerge.
Specifically, from my app I create a word instance, create a new
document (which will be the mail merge template) and link to the CSV
data source so users can write the letter template and select fields.
To be able to control word, I implement in my app Word's Application2
interface, so I can detect when users close the document (or word) to
save it and close Word too. I use for this event
ApplicationEvents2_DocumentBeforeClose
Also, since I control the template name from external application, I
managed to prevent users to save template with different name, using
event ApplicationEvents2_DocumentBeforeSave, where if SaveAsUI is true,
I set it to false.
I want also to not let users to create or open other documents from
that instance of Word.
Unfortunately I cannot find a way to prevent this. Neither _New nor
_Open events does not have Cancel parameter, and my event handler is
called after default handler.
Also, I saw the events for Document object also does not have Cancel
parameter.
Any suggestion will be appreciated.
Thank you
Bogdan Zamfir
I have an application written in VFP (but this doesn't really mattter,
it could be in VBA too) which nmeeds to allow users to create some DOC
templates for mailmerge.
Specifically, from my app I create a word instance, create a new
document (which will be the mail merge template) and link to the CSV
data source so users can write the letter template and select fields.
To be able to control word, I implement in my app Word's Application2
interface, so I can detect when users close the document (or word) to
save it and close Word too. I use for this event
ApplicationEvents2_DocumentBeforeClose
Also, since I control the template name from external application, I
managed to prevent users to save template with different name, using
event ApplicationEvents2_DocumentBeforeSave, where if SaveAsUI is true,
I set it to false.
I want also to not let users to create or open other documents from
that instance of Word.
Unfortunately I cannot find a way to prevent this. Neither _New nor
_Open events does not have Cancel parameter, and my event handler is
called after default handler.
Also, I saw the events for Document object also does not have Cancel
parameter.
Any suggestion will be appreciated.
Thank you
Bogdan Zamfir