Code to Delete All Macros

Code to Delete All Macros

am 16.04.2008 20:47:38 von louishong

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

am 16.04.2008 21:53:56 von fredg

On Wed, 16 Apr 2008 11:47:38 -0700 (PDT), louishong@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

am 18.04.2008 00:30:08 von louishong

On Apr 16, 12:53=A0pm, fredg wrote:
> On Wed, 16 Apr 2008 11:47:38 -0700 (PDT), louish...@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!