Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing Visual Basic Code from Word 1

Status
Not open for further replies.

bsquared18

Technical User
Jun 10, 2001
329
US
After placing a visual basic macro in a Word document, I decided later that I wanted to remove it. But after I deleted the code from the Visual Basic Editor, the warning message about macros still appears when I open the document.

I want to stop that warning from appearing, so that it doesn't freak out other users who will be viewing the file on other computers. Is there a way to delete the VB macro in a way that will stop the message from appearing when the document is opened?

Thanx
 
Dreamboat, thanks for the quick response. Am I correct that what you are referring to is a file called "This Document" in the "Microsoft Word Objects" folder in Visual Basic? If so, I couldn't figure out how to delete it. That option isn't offered. (By the way, I'm working in Word 97, if that makes any difference.)
 
I have seen this problem before. Your best bet would be to open a new Word document and copy the content of the one that "contains" the macros.
 
1. Open the document in question.
2. Go to Tools - Macro
3. In the box that opens, go to the field labeled "Macros In" and select the current document (I think you'll have to select by file name.
4. The macro list should show all macros in the document.
5. Delete the Macros. You can also select Edit and delete everything from the VB editor.

Hope this helps.
 
jthomas666,

Tried your suggestion, but no luck. When I select the document name in the "Macros In" box, no macros are listed. That's probably why in the VB Editor it doesn't give me the option of deleting the VB macro. It's as though it doesn't exist, but it does, because I get the warning message when I open the document. Could the fact that I'm working in Word 97 instead of 2000 have anything to do with this?

The only thing that has worked so far is "dsi's" suggestion to copy the entire contents into a new document.

BB
 
The next step would be to try all of the options in that "Macros In" field and try and determine exactly where the macro is. It may be in your normal.dot.

Of course, if copying the text to a new document has worked, then it may not matter. But it would be best to get rid of the macro, just in case.
 
See Microsoft KBA WD97: Macro Virus Warning Displayed When No Macros Exist in File - Q161515. Part of the kba is below.

SYMPTOMS
When you open a Word 97 document or template, you get the following macro virus warning, although the document or template does not contain any macros:

The document you are opening contains macros or customizations. Some macros contain viruses that could harm your computer.

If you are sure this document is from a trusted source, click Enable Macros. If you are not sure and want to prevent any macros from running, click Disable Macros.



CAUSE
When you delete macros from a document or template, some macro storage components are left behind. The macro virus protection feature finds this information, and the warning message is displayed.
 
Thanks Donna.

I read the notice you referenced. Turns out one of the workarounds is what I did: copying the contents to a new document. Now I know that the problem is unique to Word 97.

BB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top