IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Some ways to do it
One way is to take the macro out of your Autoexec Startup for the document. Usually the error doesn't happen until a macro is run IIRC. Of course my experience is only with Office 2000 and previous versions, so I don't know how newer versions handle that.

One quick way is to save the document as RTF and then load it and save it as a Doc file. Just hope that you don't lose any important formatting. Save it as a different name and see if it strips out the macro, I am sure it will. I am not sure how it will handle tables, bookmarks, and other Word features. Another way may be to use OpenOffice.Org as I think it does strip out macros as it doesn't use them, but don't quote me on that.

Even if you have a self destructing macro, the user will still get the "This document has a macro" error. They will get it only once and after they run the macro it should clean itself off.

What you want is almost the reverse of a Macro Virus, you have a Macro that kills itself.

I found this self-modifying code:
[link|http://chrisrae.com/vba/routines/selfmodify.html|http://chrisrae.com/...s/selfmodify.html]

I am sure that you can use it in reverse to delete lines. Look up the "Application.VBE.ActiveVBProject.VBComponents" object.

Ah yes, I think I found it:
[link|http://www.excel-center.com/mailing/067699h.htm|http://www.excel-cen...iling/067699h.htm]

'Place the code below into the standard module
Sub ModuleClear()
MsgBox "I am not there!"
With Application.VBE.ActiveVBProject
.vbComponents.Remove .vbComponents("MyModule")
End With
End Sub

Just put in the name of your module in the "MyModule" place and it should work. Maybe remove the Msgbox as it doesn't really serve a purpose.

I know the example is for Excel, but I think the VBE object also exists in Word.



"Lady I only speak two languages, English and Bad English!" - Corbin Dallas "The Fifth Element"

Expand Edited by orion Nov. 11, 2003, 04:09:36 PM EST
New And this is why I never filtered you. (new thread)
Created as new thread #125182 titled [link|/forums/render/content/show?contentid=125182|And this is why I never filtered you.]
The universe makes no sense until you accept that God uses base 13.

Even then, it's still pretty dodgy.
New RTF Conversion.
I don't know about Word 2000 and newer, but in Word 97, RTF-save didn't support any custom UI elements (menubars, keybindings, etc), macros or form-mode. Everything else saved and loaded a-okay. I had Word 97 default to RTF format for quite a while.

Wade.

Is it enough to love
Is it enough to breathe
Somebody rip my heart out
And leave me here to bleed
 
Is it enough to die
Somebody save my life
I'd rather be Anything but Ordinary
Please

-- "Anything but Ordinary" by Avril Lavigne.

New Boy, was *that* not what I expected
I read your subject line as "RTF Conversation". And of course mentally converted "RTF" to the other well known acronym. Was wondering, "Geez, why is Wade going off on Norm?"
===

Implicitly condoning stupidity since 2001.
New You're working too hard.


Peter
[link|http://www.debian.org|Shill For Hire]
[link|http://www.kuro5hin.org|There is no K5 Cabal]
[link|http://guildenstern.dyndns.org|Blog]
New Nope, thought the same too...
"All men are like grass, and all their glory is like the flowers of the field;
the grass withers and the flowers fall, but the word of the Lord stands forever."
1 Peter 1:24-25
New I had done a "double take" to get it right.
Alex

"The illegal we do immediately. The unconstitutional takes a little longer." - Henry Kissinger
New LOL.

Is it enough to love
Is it enough to breathe
Somebody rip my heart out
And leave me here to bleed
 
Is it enough to die
Somebody save my life
I'd rather be Anything but Ordinary
Please

-- "Anything but Ordinary" by Avril Lavigne.

     Programmatically stripping VBA from a document? - (inthane-chan) - (12)
         No clue, but... - (ben_tilly) - (2)
             Re: No clue, but... - (deSitter) - (1)
                 The goal is only to avoid annoying the users - (ben_tilly)
         CodeModule - (altmann)
         Some ways to do it - (orion) - (7)
             And this is why I never filtered you. (new thread) - (inthane-chan)
             RTF Conversion. - (static) - (5)
                 Boy, was *that* not what I expected - (drewk) - (4)
                     You're working too hard. -NT - (pwhysall) - (1)
                         Nope, thought the same too... -NT - (jbrabeck)
                     I had done a "double take" to get it right. -NT - (a6l6e6x)
                     LOL. -NT - (static)

The very ink with which history is written is merely fluid prejuidice.
105 ms