Code to Delete All Macros
Hello,
On Macros tab I have quite a few macro names. I would like to delete
all of them instead of doing it manually. Is this possible through
code, and if so, does anyone have a sample? TIA.
Re: Code to Delete All Macros
On Wed, 16 Apr 2008 11:47:38 -0700 (PDT), louishong [at] lycos.com wrote:
> Hello,
>
> On Macros tab I have quite a few macro names. I would like to delete
> all of them instead of doing it manually. Is this possible through
> code, and if so, does anyone have a sample? TIA.
Public Sub DeleteAllMacros()
Dim doc As Document
Dim Cont As Container
For Each Cont In CurrentDb.Containers
If Cont.Name = "Scripts" Then
For Each doc In Cont.Documents
DoCmd.DeleteObject acMacro, doc.Name
Next doc
End If
Next Cont
End Sub
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Re: Code to Delete All Macros
On Apr 16, 12:53=A0pm, fredg <fgutk... [at] example.invalid> wrote:
> On Wed, 16 Apr 2008 11:47:38 -0700 (PDT), louish... [at] lycos.com wrote:
> > Hello,
>
> > On Macros tab I have quite a few macro names. =A0I would like to delete
> > all of them instead of doing it manually. =A0Is this possible through
> > code, and if so, does anyone have a sample? =A0TIA.
>
> Public Sub DeleteAllMacros()
>
> Dim doc As Document
> Dim Cont As Container
> For Each Cont In CurrentDb.Containers
> =A0 =A0 If Cont.Name =3D "Scripts" Then
> =A0 =A0 =A0 =A0 For Each doc In Cont.Documents
> =A0 =A0 =A0 =A0 =A0 =A0 =A0DoCmd.DeleteObject acMacro, doc.Name
> =A0 =A0 =A0 =A0 Next doc
> =A0 =A0 =A0End If
> Next Cont
> End Sub
> --
> Fred
> Please respond only to this newsgroup.
> I do not reply to personal e-mail
Thanks so much!