Code to Delete All Macros

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • louishong@lycos.com

    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.
  • fredg

    #2
    Re: Code to Delete All Macros

    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.Conta iners
    If Cont.Name = "Scripts" Then
    For Each doc In Cont.Documents
    DoCmd.DeleteObj ect 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

    Comment

    • louishong@lycos.com

      #3
      Re: Code to Delete All Macros

      On Apr 16, 12:53 pm, fredg <fgutk...@examp le.invalidwrote :
      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.  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.Conta iners
          If Cont.Name = "Scripts" Then
              For Each doc In Cont.Documents
                   DoCmd.DeleteObj ect 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
      Thanks so much!

      Comment

      Working...