Re: VBA to remove modules in .DOT
- From: Nada Effinway <NadaEffinway@xxxxxxxxxxxxx>
- Date: Tue, 12 Apr 2005 18:02:18 GMT
Thanks, I found and got your suggested approach working --sort of.
It seems to remove the macro code from the reference template.
I guess I am not so Word smart either. I took for granted the macros
were inherited into the .DOC made from the .DOT. That seems to be wrong.
The macros remain in the .DOT with a reference back to the template.
I am trying to make sure the .DOC no longer has the macros (Word seems to
be on-board with me on that already).
I think what I want at this point of understanding would be a way to
break the link back to the .DOT after the user has used the .DOT to
create the .DOC and closed the file. I will explore what VBA
instructions there may be to "break" that reference. Perhaps you or
others know a bit about this?
Thanks for the help.
Warren
"Perry" <DrumProgrammer@xxxxxxxxxxx> wrote in
news:evtPR$sPFHA.3704@xxxxxxxxxxxxxxxxxxxx:
> 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
>> >
>
>
>
.
- References:
- Re: VBA to remove modules in .DOT
- From: Perry
- Re: VBA to remove modules in .DOT
- From: Needmo Smarts
- Re: VBA to remove modules in .DOT
- From: Perry
- Re: VBA to remove modules in .DOT
- From: Needmo Smarts
- Re: VBA to remove modules in .DOT
- From: Perry
- Re: VBA to remove modules in .DOT
- Prev by Date: Re: Object required.
- Next by Date: Autofill a form field when document opens
- Previous by thread: Re: VBA to remove modules in .DOT
- Next by thread: Re: VBA to remove modules in .DOT
- Index(es):
Relevant Pages
|