Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3229784
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:51:03+00:00 2026-05-17T16:51:03+00:00

In vba, how can i call a word document and get a list of

  • 0

In vba, how can i call a word document and get a list of all the macros it contains?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T16:51:03+00:00Added an answer on May 17, 2026 at 4:51 pm

    This article should show you how to do it (it’s for Word 2000 but I assume there’s a good chance it’ll work for whatever version you use): WD2000: Sample Macro to Return Macro and Procedure Names

    This is the code from that article:

    Sub ListAllMacroNames()
    
    Dim pj As VBProject
    Dim vbcomp As VBComponent
    Dim curMacro As String, newMacro As String
    Dim x As String
    Dim y As String
    
    On Error Resume Next
    curMacro = ""
    Documents.Add
    
    For Each pj In Application.VBE.VBProjects
       x = pj.FileName
       y = pj.Protection
    
       If x <> "" Then
    
          If y <> "1" Then
             Selection.InsertAfter "The " & Chr(34) & x & Chr(34) & _
                " project contains " & "the following macro names:" & vbCr
             Selection.InsertAfter vbCr
    
             For Each vbcomp In pj.VBComponents
    
                For i = 1 To vbcomp.CodeModule.CountOfLines
                   newMacro = vbcomp.CodeModule.ProcOfLine(Line:=i, _
                      prockind:=vbext_pk_Proc)
    
                   If curMacro <> newMacro Then
                      curMacro = newMacro
    
                      If curMacro <> "" And curMacro <> "app_NewDocument" Then
                            Selection.InsertAfter newMacro & vbCr
                            Selection.Collapse wdCollapseEnd
                         End If
                   End If
                Next
             Next
         Else
            Selection.InsertAfter "The project " & Chr(34) & x & Chr(34) & _
               " is locked. " & "Macros in this locked project will not be" _
               & " listed." & vbCr & vbCr
         End If
         Selection.InsertAfter vbCr
       End If
       x = ""
    Next
    Selection.Collapse wdCollapseEnd
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to extract all of the VBA code from a Word 2007
I have the following vba-code in an MS-Access97-frontend which opens a word-document stored on
How can I view VBA script of .doc file in MS Word 2010?
Can VBA code instantiate and use .NET objects? The specific class I'm interested in
Is there code in VBA I can wrap a function with that will let
What function can I use in Excel VBA to slice an array?
How can I put up a File Open dialog from some VBA running in
How can I count to 10 while summing the numbers in VBA?
Using VBA, how can I: test whether a file exists, and if so, delete
Can anyone recommend an SVN client for use in Excel with VBA (code modules

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.