Post #125,179
11/11/03 4:07:03 PM
11/11/03 4:09:36 PM
|
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"
Edited by orion
Nov. 11, 2003, 04:09:36 PM EST
One way to do it
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"
|
Post #125,183
11/11/03 4:16:55 PM
|
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.
|
Post #125,278
11/12/03 6:53:04 AM
|
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. |
|
Post #125,304
11/12/03 9:31:05 AM
|
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.
|
Post #125,369
11/12/03 2:33:39 PM
|
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]
|
Post #125,373
11/12/03 2:41:46 PM
|
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
|
Post #125,402
11/12/03 4:44:52 PM
|
I had done a "double take" to get it right.
Alex
"The illegal we do immediately. The unconstitutional takes a little longer." - Henry Kissinger
|
Post #125,645
11/14/03 5:42:46 AM
|
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. |
|