Re: VBA to remove modules in .DOT

Tech-Archive recommends: Fix windows errors by optimizing your registry



VBA environment (VBE) menu:
Tools | References
>From the next dialog, choose
"Microsoft Visual Basic for Applications Extensibility Library 5.3"
Should be one of the libraries available to you; in Office 2000 as well.

Good luck when finding time to work on it.

Krgrds,
Perry

"Needmo Smarts" <not_here@xxxxxxxxxxxx> wrote in message
news:Xns9634D8E999B62xkxnxaxuxex@xxxxxxxxxxxxxxxxx
> Perry,
> Thanks for hanging in there & providing help.
> You are somewhat over my head--I don't know anything about the VBA
> Extensibility lib 53. I am using Word 2000 and have no other VB product.
> I will try using the Subs you've provided when I get the chance this week
> at work (BIG assumption!) Looks like I'll need to declare and use an
> object representing the current document...
>
> Thanks,
> Warren
>
> "Perry" <DrumProgrammer@xxxxxxxxxxx> wrote in
> news:#OWq93bPFHA.1564@xxxxxxxxxxxxxxxxxxxx:
>
> > Add a reference in VBE pointing to: Microsoft VBA Extensibility lib 53
> > Two examples removing either a module "MYModule" or a macro "MyMacro"
> > from a document represented by object variable: "TargetDocument"
> >
> > Sub DeleteProcedure()
> > Dim vbc As VBComponent
> > Set vbc = TargetDocument.VBProject.VBComponents("MYModule")
> > With vbc.CodeModule
> > .DeleteLines .ProcStartLine("MyMacro", vbext_pk_Proc), _
> > .ProcCountLines("MyMacro", vbext_pk_Proc)
> > End With
> > End Sub
> >
> > Sub DeleteModule()
> > Dim vbc As VBComponent
> > Set vbc = TargetDocument.VBProject.VBComponents("MYModule")
> > ThisDocument.VBProject.VBComponents.Remove vbc
> > End Sub
> >
> >
> > Krgrds,
> > Perry
> >


.


Quantcast