K
ksopher
Version: Word 2000, 2002
OS: Win2K, WinXP
With the macro security set to High, when I try to open a document
containing an AutoOpen macro it does not run and I am propmted with the
usual message about macros not being enabled. This is what I want.
I have a VB.NET application that automates Word using a COM wrapper.
When I open the same document programmatically on the same computers
the AutoOpen macro runs. I do not want this to happen. There is going
to be no user interaction, so holding the shift key and other such
tricks aren't realistic options. I do not have control over the
documents being processed, they are being submitted for processing by
external users.
The code I'm using is pretty rock-solid. It's been in production for 2
years. The line executed where the file is open is:
OpenDoc = WordApp.Documents.Open(FileName:=aFileName, ReadOnly:=True)
Due to security concerns I need to ensure that the auto macros don't
run when the file is opened via automation on the server.
What do I need to do to have the Word automation respect the Word macro
security settings? I've created the necessary Registry keys in HKLC so
that they override anything at the HKCU or application level, but this
isn't stopping it through automation. I've scoured the WROX Word 2000
VBA Programmer's Reference, MSDN online, Google Groups, etc., but can't
find anything. Alternatively, I'd be happy to just remove the AutoOpen
macros (and AutoExec, AutoNew), but it seems like a catch-22 - I can't
delete them unless I open the document first, but by then the macros
have run.
TIA - Keith
OS: Win2K, WinXP
With the macro security set to High, when I try to open a document
containing an AutoOpen macro it does not run and I am propmted with the
usual message about macros not being enabled. This is what I want.
I have a VB.NET application that automates Word using a COM wrapper.
When I open the same document programmatically on the same computers
the AutoOpen macro runs. I do not want this to happen. There is going
to be no user interaction, so holding the shift key and other such
tricks aren't realistic options. I do not have control over the
documents being processed, they are being submitted for processing by
external users.
The code I'm using is pretty rock-solid. It's been in production for 2
years. The line executed where the file is open is:
OpenDoc = WordApp.Documents.Open(FileName:=aFileName, ReadOnly:=True)
Due to security concerns I need to ensure that the auto macros don't
run when the file is opened via automation on the server.
What do I need to do to have the Word automation respect the Word macro
security settings? I've created the necessary Registry keys in HKLC so
that they override anything at the HKCU or application level, but this
isn't stopping it through automation. I've scoured the WROX Word 2000
VBA Programmer's Reference, MSDN online, Google Groups, etc., but can't
find anything. Alternatively, I'd be happy to just remove the AutoOpen
macros (and AutoExec, AutoNew), but it seems like a catch-22 - I can't
delete them unless I open the document first, but by then the macros
have run.
TIA - Keith