ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel XP error message Run Time Error 91 (https://www.excelbanter.com/excel-programming/324537-excel-xp-error-message-run-time-error-91-a.html)

Lenny[_3_]

Excel XP error message Run Time Error 91
 
When executing the following code.

Dim WkbName As String

WkbName = Application.CommandBars.ActionControl.Parameter
If WkbName = "" Or WkbName = "ThisWorkbook" Then WkbName = ThisWorkbook.Name

I get the following error message

Run-time error '91':
Object variable or With block variable not set

COuld someone please help me correct the problem or help me with the syntax



Bob

Excel XP error message Run Time Error 91
 
The Parameter property only appears to apply to a specific Control on a
specific Commandbar. Therefore, your code would read something like:
WkbName = Application.CommandBars("name".ActionControl("name ').Parameter
subtituing the real names where "name" is indicated

"Lenny" wrote:

When executing the following code.

Dim WkbName As String

WkbName = Application.CommandBars.ActionControl.Parameter
If WkbName = "" Or WkbName = "ThisWorkbook" Then WkbName = ThisWorkbook.Name

I get the following error message

Run-time error '91':
Object variable or With block variable not set

COuld someone please help me correct the problem or help me with the syntax





All times are GMT +1. The time now is 07:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com