Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Seth Ford   on Sep 29 In MS Office Category.

  
Question Answered By: Laurel Collins   on Sep 29

Here's a page with some tips on programming within VBE:

http://www.cpearson.com/excel/vbe.htm

For example, if I run the code below in a newly opened workbook, it
will list the names of all the standard modules for all of the open
workbooks (including add-ins!). If there are no other open workbooks,
you'll just get the add-ins you have active. I think all you'd need
to do is change append of the module name to the "Msg" string to be an
export of the module from "oComponent" and an import into
"ThisWorkBook...". There are examples of that on the web page I cited
above.

===============================================================

Sub ListStandardModules()
' Needs "Microsoft VBS Extensibility" reference
Dim oComponent As VBComponent
For Each oProject In Application.VBE.VBProjects
If oProject.Name <> ThisWorkbook.VBProject.Name Then
If oProject.Protection = False Then
Msg = Msg & "-------->" & oProject.Name & Chr(13)
For Each oComponent In oProject.VBComponents
If oComponent.Type = vbext_ct_StdModule Then
Msg = Msg & oComponent.Name & Chr(13)
End If
Next oComponent
End If
End If
Next oProject
MsgBox Msg
End Sub

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Combining XLA files into 1 XLA Or get search suggestion and latest updates.


Tagged: