![]() |
#1
|
|||
|
|||
![]()
I have a macro that iterates through all VB projects' code modules to gather information about them. The loops look like the following:
For k = 1 To Application.VBE.VBProjects.Count ' 1st one is Normal then documents Set VBProj = Application.VBE.VBProjects(k) If VBProj.Protection = vbext_pp_none Then ' Process code modules only For j = 1 To VBProj.VBComponents.Count ' Iterate thru components Set VBComp = VBProj.VBComponents(j) Set CodeMod = VBComp.CodeModule ' Process Code Module with CodeMod . . end with The only way I could return the name of the document (or Template in the case of Normal which is always the first VB project) that each CodeMod belongs to was from the code pane's window's caption: sFilename = Left(.CodePane.Window.Caption, InStr(CodeMod.CodePane.Window.Caption, "-") - 2) This worked fine in Word 2011. But I've been forced to upgrade to 2019 and the system reports an error with CodeMod.CodePane.Window.Caption now (see attachment). Can anyone tell me how to go about getting the name of the document from the VB project or it's components/modules? All help is much appreciated! Last edited by VBorNotVB; 11-02-2018 at 07:15 AM. Reason: Title Ambiguous |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
filename field not displaying correct filename when that name starts with # | plrsmith | Word | 1 | 07-06-2018 03:10 AM |
How to modify the Gantt chart bar styles (label of values) in project center (WPA) (MS Project 2010) | Cedahlia | Project | 0 | 04-21-2018 10:29 PM |
Is it a bug or not ? Ms Project randomly changes project's tasks resources name when re-open file ? | capsule | Project | 1 | 11-26-2017 06:45 AM |
Project task numbering changed after linking item in subproject to m aster project | rrs_2017 | Project | 0 | 09-06-2017 06:07 AM |
Microsoft Project Server, Microsoft Project Online and Project Web App - Whats the difference? | chocolateCupcakes | Project | 1 | 02-11-2017 12:25 PM |