VBA Application MacroOptions

excelgolfer

New Member
Joined
Nov 27, 2018
Messages
2
Hi,
This Macro code won't list all the Argument Descriptions, it only list the first description in the array "ArgDesc (1 to 2). How do i list all the strings in the array "ArgDesc" ?
thanks

Code:
Sub DescribeFunction()
'This can be used to add help text to each function


   Dim FuncName As String
   Dim FuncDesc As String
   Dim Category As String
   Dim ArgDesc(1 To 2) As String
  
'type the function name in the quotes below
   FuncName = "OilHeat_DSN100G_LOF"


'type the help text in the quotes below
   FuncDesc = "estimates the oil heat gain in (BTU/min) with oil restrictor plug installed, from input power (hp)and airend adiabatic efficiency (%)"
   
   Category = 14 'User Defined
   
'type the argument descriptions in the quotes below.  Add more arguments as needed, and change X in Dim ArgDesc(1 To X)
 'to a number at least as large as total number of arguments
   ArgDesc(1) = " = input power (hp)"
   ArgDesc(2) = " = System adiabatic efficiency (%)"
         
   Application.MacroOptions _
      Macro:=FuncName, _
      Description:=FuncDesc, _
      Category:=Category, _
      ArgumentDescriptions:=ArgDesc


'run the macro called DescribeFunction, then save


End Sub
 

Some videos you may like

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

NdNoviceHlp

Well-known Member
Joined
Nov 9, 2002
Messages
2,484
Code:
Dim ArgDesc(1 To 2) As Variant
Maybe...
Code:
ArgumentDescriptions:=ArgDesc(1) & ArgDesc(2)
HTH. Dave
 

excelgolfer

New Member
Joined
Nov 27, 2018
Messages
2
Dave,
Thanks for the quick reply.
Got a run time error on the last line.
ArgumentDescriptions:=ArgDesc(1) & ArgDesc(2)
Any other suggestions.

I tried

Code:
ArgumentDescriptions:=ArgDesc()

Only listed the first variable again
 

NdNoviceHlp

Well-known Member
Joined
Nov 9, 2002
Messages
2,484
Where's the code for the FuncName macro? I have no idea what Application.MacroOptions is nor have I seen it used in code before? To get data out of an array...
Code:
For Cnt = LBound(ArgDesc) To UBound(ArgDesc)
Msgbox ArgDesc(cnt)
Next Cnt
Maybe others will have better vision than me? Dave
 

Watch MrExcel Video

Forum statistics

Threads
1,095,475
Messages
5,444,701
Members
405,298
Latest member
fxtrtr17

This Week's Hot Topics

Top