Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Obtain list of Actions/Comments for a Macro? 1

Status
Not open for further replies.

Ajb2528

Technical User
Feb 22, 2002
270
GB
Hi!

I was wondering, if there is any way via the MSYSxxxxx tables (or another way i.e. vba code), there was a way of listing all of the actions and comments associated with a macro (other than using the documenter).

Any help would be appreciated!

Regards,

Alan
 
I tried some while ago faq705-5796, but as you can see from the date, it predates the 2007 version somewhat ;-)

...but I just did a small test in the 2007 version, and it seems to work, at least for macros created with previous versions. Feel free to play with it, if you wish.

There are other third-party documentors around, too. I'm afraid I haven't got any links at the moment.

Roy-Vidar
 
Hi Roy-Vidar!

Thanks for your prompt reply! Its a really usefull piece of code! How would I go about amending the code to extract the comments field (for each line of the macro) as this is quite important to me!

Regards,

Alan

P.S. - I have given you a star!
 
I haven't looked at that code in years, but I just added something in the comment part of a couple of macros in tge 2007 version, and it was outputted in the resulting text file?!

Did you try?

Roy-Vidar
 
Replacing

[tt] For lngcounter = 0 To UBound(strArgs)
If (InStr(strArgs(lngcounter), "Macroname") > 0) Then
strOut = strOut & _
Split(strArgs(lngcounter), "=")(1) & vbNewLine
End If
If (InStr(strArgs(lngcounter), "Condition") > 0) Then
strOut = strOut & vbTab & _
Split(strArgs(lngcounter), "=")(1) & vbNewLine
End If
If (InStr(strArgs(lngcounter), "Action") > 0) Then
strOut = strOut & vbTab & vbTab & vbTab & _
Split(strArgs(lngcounter), "=")(1) & vbNewLine
End If
Next lngcounter
#Else
strMacro = rvsSplit(m.Value, "Argument =")
s1 = rvsSplit(strMacro(0), vbCrLf)
For lngcounter = 0 To UBound(s1)
If (InStr(s1(lngcounter), "Macroname") > 0) Then
strOut = strOut & _
rvsSplit(s1(lngcounter), "=")(1) & vbNewLine
End If
If (InStr(s1(lngcounter), "Condition") > 0) Then
strOut = strOut & vbTab & _
rvsSplit(s1(lngcounter), "=")(1) & vbNewLine
End If
If (InStr(s1(lngcounter), "Action") > 0) Then
strOut = strOut & vbTab & vbTab & vbTab & _
rvsSplit(s1(lngcounter), "=")(1) & vbNewLine
End If
Next lngcounter[/tt]

with

[tt] For lngcounter = 0 To UBound(strArgs)
If (InStr(strArgs(lngcounter), "Macroname") > 0) Then
strOut = strOut & _
Split(strArgs(lngcounter), "=")(1) & vbNewLine
End If
If (InStr(strArgs(lngcounter), "Condition") > 0) Then
strOut = strOut & vbTab & _
Split(strArgs(lngcounter), "=")(1) & vbNewLine
End If
If (InStr(strArgs(lngcounter), "Action") > 0) Then
strOut = strOut & vbTab & vbTab & vbTab & _
Split(strArgs(lngcounter), "=")(1) & vbNewLine
End If
If (InStr(strArgs(lngcounter), "Comment") > 0) Then
strOut = strOut & vbTab & vbTab & vbTab & _
Split(strArgs(lngcounter), "=")(1) & vbNewLine
End If
Next lngcounter
#Else
strMacro = rvsSplit(m.Value, "Argument =")
s1 = rvsSplit(strMacro(0), vbCrLf)
For lngcounter = 0 To UBound(s1)
If (InStr(s1(lngcounter), "Macroname") > 0) Then
strOut = strOut & _
rvsSplit(s1(lngcounter), "=")(1) & vbNewLine
End If
If (InStr(s1(lngcounter), "Condition") > 0) Then
strOut = strOut & vbTab & _
rvsSplit(s1(lngcounter), "=")(1) & vbNewLine
End If
If (InStr(s1(lngcounter), "Action") > 0) Then
strOut = strOut & vbTab & vbTab & vbTab & _
rvsSplit(s1(lngcounter), "=")(1) & vbNewLine
End If
If (InStr(s1(lngcounter), "Comment") > 0) Then
strOut = strOut & vbTab & vbTab & vbTab & _
rvsSplit(s1(lngcounter), "=")(1) & vbNewLine
End If
Next lngcounter[/tt]

seems to output the info in the output.txt file (though in the wrong place...), but I haven't the time to go into this code at the moment.

Roy-Vidar
 
Hi Roy-Vidar!

Thanks for getting back to me! It works a treat!

Regards,

Alan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top