Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Removing Macros from a Word document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jay - 12 Jan 2006 13:31 GMT
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.
Cindy M  -WordMVP- - 12 Jan 2006 17:03 GMT
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
[quoted text clipped - 6 lines]
> 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 :-)
Jay - 13 Jan 2006 10:01 GMT
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

> If what you pasted contains ActiveX controls, that will cause what
> you're seeing. ActiveX controls have a programming component that will
[quoted text clipped - 3 lines]
> everything but the last paragraph mark to a new document to get rid of
> the problem.
Cindy M  -WordMVP- - 15 Jan 2006 18:06 GMT
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 :-)
Jay Freedman - 15 Jan 2006 19:14 GMT
>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
[quoted text clipped - 3 lines]
>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        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
Tony Jollans - 16 Jan 2006 00:49 GMT
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?

--
Enjoy,
Tony

> Thanks Cindy, that fixed it.
>
[quoted text clipped - 24 lines]
> of
> > the problem.
Anne Troy - 16 Jan 2006 07:06 GMT
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

> I'd really like to see this happening because I had no idea Copy or Paste
> could be so 'clever'.
[quoted text clipped - 34 lines]
>> of
>> > the problem.
Jay - 16 Jan 2006 09:37 GMT
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
Tony Jollans - 16 Jan 2006 12:06 GMT
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.

--
Enjoy,
Tony

> Hi Tony,
>
[quoted text clipped - 29 lines]
>
> Jay
Jay Freedman - 17 Jan 2006 03:16 GMT
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        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

>Thank you Jay.
>
[quoted text clipped - 46 lines]
>>
>> Jay
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.