Re: VBA to remove modules in .DOT



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
>> >
>
>
>

.



Relevant Pages

  • Re: Typing dots under words in English
    ... But I can't do a dot under ... What if you don't have a number pad? ... you've ever played with macros, ... Sub UwithMacron() ...
    (soc.culture.jewish.moderated)
  • Re: Auto Paste Values
    ... You will need to establish the reference first. ... Sub copyclean() ... Dim VBComp As VBIDE.VBComponent ... macros etc - as a result the file is a chunky 16MB. ...
    (microsoft.public.excel.programming)
  • Re: Typing dots under words in English
    ... But I can't do a dot ... you've ever played with macros, ... Sub UwithMacron() ... You can make one for each character you want to be able to enter. ...
    (soc.culture.jewish.moderated)
  • Re: Typing dots under words in English
    ... But I can't do a dot ... and an o with a diaresis). ... you've ever played with macros, ... Sub UwithMacron() ...
    (soc.culture.jewish.moderated)
  • Re: Absolute Worksheet References
    ... Sub testme() ... And I saw this in the immediate window. ... > immediate window and the macros run as intended, ... > "Reference Not Valid" message. ...
    (microsoft.public.excel.programming)