Re: Word automation bypasses macro security
From: Jonathan West (jwest_at_mvps.org)
Date: 02/25/05
- Next message: ksopher: "Re: Word automation bypasses macro security"
- Previous message: ksopher_at_comcast.net: "Word automation bypasses macro security"
- In reply to: ksopher_at_comcast.net: "Word automation bypasses macro security"
- Next in thread: ksopher: "Re: Word automation bypasses macro security"
- Reply: ksopher: "Re: Word automation bypasses macro security"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 25 Feb 2005 00:50:40 -0000
Precede that line of code with this
WordApp.WordBasic.DisableAutoMacros(1)
To turn auto macros on again at the end of the routine, use this
WordApp.WordBasic.DisableAutoMacros(0)
-- Regards Jonathan West - Word MVP www.intelligentdocuments.co.uk Please reply to the newsgroup <ksopher@comcast.net> wrote in message news:1109292316.421251.33100@f14g2000cwb.googlegroups.com... > 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 >
- Next message: ksopher: "Re: Word automation bypasses macro security"
- Previous message: ksopher_at_comcast.net: "Word automation bypasses macro security"
- In reply to: ksopher_at_comcast.net: "Word automation bypasses macro security"
- Next in thread: ksopher: "Re: Word automation bypasses macro security"
- Reply: ksopher: "Re: Word automation bypasses macro security"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|