Click here to Skip to main content
11,805,316 members (62,608 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: COM Word VisualC++
I want to open a doc file by the way as follows;
_Application wApp;
Documents wDocs = wApp.GetDocuments();
_Document wDoc = wDocs.Open(COleVariant("...doc"), vNotFind,vNotFind,vNotFind,vNotFind,vNotFind,vNotFind,vNotFind,vNotFind,vNotFind,vNotFind,vNotFind,vNotFind,vNotFind,vNotFind,vNotFind);

But when it goes to "wDocs.Open(", the macro as follows in doc file will run.

Sub autoopen()
MsgBox "hello"
End Sub

how to stop it?
My english is just-so-so, so forgive me.
Posted 8-Feb-12 0:23am
SAKryukov at 8-Feb-12 11:00am
Good question, because this is important thing, my 5.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Your English did not betray you; I wish other inquirers could write so correctly and clearly.

It is very important to switch off macro processing, because macro is dangerous feature. I checked my Word installation; it is using by default the option like "disable macros except trusted locations", and the trusted locations are only those created by the Word installation, not where I can normally copy the document.

So, that said, you should take care about it in the Word settings. The procedure depends on your Word version. Check or search for "disable macros" in your help. In newer versions it's done via "Word Settings" -> "Trust Center".

For example:[^],[^].

See also (for older versions): "How to switch off bad features of MS Word
and other Windows problems",[^].

Keep it safe,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 315
1 Richard Deeming 225
2 Sergey Alexandrovich Kryukov 190
3 CPallini 160
4 ppolymorphe 154
0 OriginalGriff 3,265
1 Maciej Los 1,990
2 KrunalRohit 1,907
3 CPallini 1,855
4 Richard MacCutchan 1,227

Advertise | Privacy | Mobile
Web03 | 2.8.151002.1 | Last Updated 8 Feb 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100