Removing Macros from a Word document

J

Jay

Occasionally when I paste something into a Word document (Word 97 SR-2
used) from the internet, after saving and closing it, when I re-open
it, I get a macros warning box, with the choice to enable or disable
macros in the document.

I assume that the macros come from something I paste from the web. How
do I remove them? Deleting everything in the document doesn't get rid
of the warning box. Nor does disabling macros and saving the document
to a new file name. I couldn't find any macros associated with the
document in the VBA editor.
 
C

Cindy M -WordMVP-

Hi Jay,
Occasionally when I paste something into a Word document (Word 97 SR-2
used) from the internet, after saving and closing it, when I re-open
it, I get a macros warning box, with the choice to enable or disable
macros in the document.

I assume that the macros come from something I paste from the web. How
do I remove them? Deleting everything in the document doesn't get rid
of the warning box. Nor does disabling macros and saving the document
to a new file name. I couldn't find any macros associated with the
document in the VBA editor.
If what you pasted contains ActiveX controls, that will cause what
you're seeing. ActiveX controls have a programming component that will
initialize the "VBA stuff".

Assuming these have been deleted from the document, you'd need to copy
everything but the last paragraph mark to a new document to get rid of
the problem.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 
J

Jay

Thanks Cindy, that fixed it.

I'm curious - is there any way of finding what ActiveX's there are in
a Word document? Are they listed anywhere in Word or in the Word VBA
editor?

When I pasted the bit from the web that caused the problem, I meant to
use Paste as Unformatted Text, but forgot that time and did a normal
paste instead. I saw what happened and immediately pressed Ctrl+Z to
undo it, but this didn't appear to remove the ActiveX.

Maybe next time I'll use the Firefox browser, since I assume that this
wouldn't have the problem (or would it?)

Best wishes,

Jay
 
C

Cindy M -WordMVP-

Hi Jay,
I'm curious - is there any way of finding what ActiveX's there are in
a Word document? Are they listed anywhere in Word or in the Word VBA
editor?
I'm not really familiar enough with what might paste in from the web,
but generally, if you press Alt+F9 to toggle the field codes, I'd think
you'd see them as fields. They should also be listed in the dropdown box
of the Properties window, when you're in the ThisDocument module of the
VB Editor (at least, those with which I'm familiar are).
When I pasted the bit from the web that caused the problem, I meant to
use Paste as Unformatted Text, but forgot that time and did a normal
paste instead. I saw what happened and immediately pressed Ctrl+Z to
undo it, but this didn't appear to remove the ActiveX.
I'm surprised Undo wouldn't have removed it. Perhaps it didn't get
inserted at that point, but by some other action?
Maybe next time I'll use the Firefox browser, since I assume that this
wouldn't have the problem (or would it?)
I'm not at all familiar with Firefox, so I couldn't say :) I guess it
depends on whether it puts the HTML from a webpage onto the Windows
clipboard as HTML, or something else.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 
J

Jay Freedman

Hi Jay,
[snip]
When I pasted the bit from the web that caused the problem, I meant to
use Paste as Unformatted Text, but forgot that time and did a normal
paste instead. I saw what happened and immediately pressed Ctrl+Z to
undo it, but this didn't appear to remove the ActiveX.
I'm surprised Undo wouldn't have removed it. Perhaps it didn't get
inserted at that point, but by some other action?

I suspect the sequence goes like this: The initial paste brings in the
ActiveX control and also sets up the macro storage space in the
document in case the control has (or will have) code. The undo removes
the control but doesn't remove the macro storage (just as removing all
the VBA modules from a document that has macros doesn't "clean" the
document). The presence of macro storage structures -- even if they're
empty -- is what causes the security warning.

[snip]

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 
T

Tony Jollans

I'd really like to see this happening because I had no idea Copy or Paste
could be so 'clever'.

Is there any chance of you pointing me to a web site with content which
causes this?
 
A

Anne Troy

Very interesting thread. Nice call, Jay. I wouldn't have thunk of it.
I'm watching, too, Tony. Every so often someone sends me an email with
ActiveX in it, and I can't figure out what causes that either.
************
Hope it helps!
Anne Troy
www.OfficeArticles.com
 
J

Jay

Hi Tony,

Here's the web page (the Google Search bit near the top and the scroll
editor at the bottom both cause the problem):
www.hmailserver.com/documentation/?page=howto_install_phpwebadmin

I've just repeated the exercise (same PC: Internet Explorer V6 SP1,
Word 97 SR2, Windows NT SP6), and the macros problem still occurs.

This time, however, an immediate Undo after pasting prevents the
problem. I guess I must have done the Undo at another point last time,
without realising that the problem had been pasted at an earlier
point.

Selecting on the web page using Ctrl+A (select all) does not cause any
problems, since for some reason, formatting is then not copied across
to Word.

To cause the problem, I had to select by dragging over the page with
my mouse.

This is what Alt+F9 revealed (??? means some info is missing since it
was behind the text boxes that had been pasted in):

{PRIVATE "TYPE=PICT;ALT=Google"} {INCLUDEPICTURE \d
"google_logo_40wht.png"} { HTMLCONTROL Forms.HTML:Text.1 \*
MERGEFORMAT \s } { HTMLCONTROL Forms.HTML:Text.1 \* MERGEFORMAT \s }
{???xt.1 \* MERGEFORMAT ???ROL Forms.HTML:Text.1 ???\s} {HTMLCONTROL
Form???FORMAT \s}

Best wishes,

Jay
 
T

Tony Jollans

Thank you Jay.

I can reproduce it but must confess a full explanation is beyond my
knowledge.

The 'code' seems to be VBScript, and not VBA, as the document does not
contain any VBA (for which I am grateful as I didn't like the notion of a
paste into a document affecting VBA modules) and trying to edit it opens the
script editor. I can, not, however, see any actual code in the editor so am
not sure exactly what component triggers the warning.

I am looking forward to learning about this.
 
J

Jay Freedman

Each of the HTMLCONTROL fields represents an ActiveX control. One is
the box where you type in the search term, the next is the Search
button, and there are three hidden controls that contain URLs pointing
to pages on hmailserver.com. To see these things:
- open the document
- display the Control Toolbox toolbar
- click the Design Mode button on the Toolbox
- select one of the ActiveX objects
- click the Properties button on the Toolbox

Once you save the document with these objects in it, the document will
always trigger the macro security warning until you clean it. As I
wrote before, it isn't necessarily the presence of the controls
themselves that does it, but an associated macro storage structure in
the file that Word interprets as a possible threat.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top