And don't forget to turn the automacros back on again afterwards!
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Jay Freedman wrote:
> Hi Ray,
>
> You should put that line before the Open call -- afterward is too
> late, as any AutoXX macros would already have run then.
>
> The WordBasic object is global, being a member of the Word.Application
> object.
>
> Ray C wrote:
>> Thanks Jay, but I had already found this solution and somehow it's
>> still not working. Where exactly am I supposed to place the following
>> line?:
>>
>> WordBasic.DisableAutoMacros 1
>>
>> 1) Immediately after I call the Open method on my document object?
>> 2) Before?
>> 3) Is this WordBasic object global? because I open a Word object in
>> my code, then I leave it in memory while I open and close document
>> objects. At the end I close my Word object.
>>
>> Thanks in advance.
>> Ray
>>
>>
>> "Jay Freedman" wrote:
>>
>>> Ray C wrote:
>>>> I have VBA code that opens a word document using:
>>>>
>>>> objDocument.Open("C:\...")
>>>>
>>>> however, some documents have macros that auto start when the
>>>> document opens, how can I tell Word to open the document and ignoe
>>>> or disable the auto macros?
>>>>
>>>> Thanks in advance
>>>>
>>>> Ray
>>>
>>> You need one of the few old WordBasic commands that aren't available
>>> in VBA outside the WordBasic object, the DisableAutoMacros command.
>>> It's documented at
>>> http://www.word.mvps.org/FAQs/MacrosVBA/WordBasicCommands.htm.
>>>
>>> --
>>> Regards,
>>> Jay Freedman
>>> Microsoft Word MVP FAQ: http://word.mvps.org
>>> Email cannot be acknowledged; please post all follow-ups to the
>>> newsgroup so all may benefit.