Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In all the macros I write, I put the name of the macro in
the title bar of all Msgbox and Inputbox msgs I generate. Is there a VBA statement that will fetch the name of the macro that is executing so I don't have to hard code the macro name into my msgs? I want something like the code that fetches the worksheet name that is currently active. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
AFAIK this is not possible -- Regards Frank Kabel Frankfurt, Germany SidBord wrote: In all the macros I write, I put the name of the macro in the title bar of all Msgbox and Inputbox msgs I generate. Is there a VBA statement that will fetch the name of the macro that is executing so I don't have to hard code the macro name into my msgs? I want something like the code that fetches the worksheet name that is currently active. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanx for the reply. I was afraid you'd say that.
-----Original Message----- Hi AFAIK this is not possible -- Regards Frank Kabel Frankfurt, Germany SidBord wrote: In all the macros I write, I put the name of the macro in the title bar of all Msgbox and Inputbox msgs I generate. Is there a VBA statement that will fetch the name of the macro that is executing so I don't have to hard code the macro name into my msgs? I want something like the code that fetches the worksheet name that is currently active. . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Perhaps this:
Sub GetProcedureName() Dim Msg As String, Style As Integer, Title As String 'If calling from a commandbar control: Title = Application.CommandBars.ActionControl.OnAction 'If calling from a worksheet based control (Forms toolbar): 'Title = ActiveSheet.Shapes(Application.Caller).OnAction Title = Right(Title, Len(Title) - InStr(1, Title, "!")) Msg = "The rain in Spain falls mainly on the plain. " Style = vbInformation MsgBox Msg, Style, Title End Sub Regards, Greg -----Original Message----- In all the macros I write, I put the name of the macro in the title bar of all Msgbox and Inputbox msgs I generate. Is there a VBA statement that will fetch the name of the macro that is executing so I don't have to hard code the macro name into my msgs? I want something like the code that fetches the worksheet name that is currently active. . |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Alternatively:
Sub TestGetProcName() Dim Msg As String, Style As Integer Msg = "The rain in Spain falls mainly on the plain. " Style = vbInformation MsgBox Msg, Style, GetProcName End Sub Function GetProcName() Dim Txt As String On Error Resume Next With Application Txt = .CommandBars.ActionControl.OnAction Txt = ActiveSheet.Shapes(.Caller).OnAction Txt = Right(Txt, Len(Txt) - InStr(1, Txt, "!")) End With On Error GoTo 0 GetProcName = Txt End Function Regards, Greg -----Original Message----- Perhaps this: Sub GetProcedureName() Dim Msg As String, Style As Integer, Title As String 'If calling from a commandbar control: Title = Application.CommandBars.ActionControl.OnAction 'If calling from a worksheet based control (Forms toolbar): 'Title = ActiveSheet.Shapes(Application.Caller).OnAction Title = Right(Title, Len(Title) - InStr(1, Title, "!")) Msg = "The rain in Spain falls mainly on the plain. " Style = vbInformation MsgBox Msg, Style, Title End Sub Regards, Greg -----Original Message----- In all the macros I write, I put the name of the macro in the title bar of all Msgbox and Inputbox msgs I generate. Is there a VBA statement that will fetch the name of the macro that is executing so I don't have to hard code the macro name into my msgs? I want something like the code that fetches the worksheet name that is currently active. . . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Incremental number for a fetching data | Excel Worksheet Functions | |||
Hide Macro's in Toolbar / Macro's list | Excel Discussion (Misc queries) | |||
Fetching data from another worksheet | New Users to Excel | |||
Fetching data from other sheets | Excel Discussion (Misc queries) | |||
Problem while fetching Excel records? | Excel Programming |