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.
louishong [ Mi, 16 April 2008 20:47 ] [ ID #1943724 ]

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
fredg [ Mi, 16 April 2008 21:53 ] [ ID #1943727 ]

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!
louishong [ Fr, 18 April 2008 00:30 ] [ ID #1944567 ]
Datenbanken » comp.databases.ms-access » Code to Delete All Macros

Vorheriges Thema: A2000 & A2003
Nächstes Thema: Option for themes.