Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Why "object variable or with block variable not set" error?
Any idea why the buttons will not be created when opening the exce sheet? The deletes work fine, but I am getting an object variable o with block variable not set error on the first With block. Also if attach the same code to a custom button and run the macro that way th buttons do get created. They only are not created when opening th excel sheet, which is what I am trying to accomplish. Any thoughts? Sub Workbook_Open() Application.CommandBars("Assembly Test").Controls(5).Delete Application.CommandBars("Assembly Test").Controls(4).Delete Application.CommandBars("Assembly Test").Controls(3).Delete Application.CommandBars("Assembly Test").Controls(2).Delete Application.CommandBars("Assembly Test").Controls(1).Delete With CommandBars("Assembly Test").Controls.Add .Caption = "Add Test Condition" .Style = msoButtonIconAndCaption .OnAction = "Sheet1.CommandButton1_Click" .BeginGroup = True .FaceId = 38 End With With CommandBars("Assembly Test").Controls.Add .Caption = "Add Main Row for Sub-Test Conditions" .Style = msoButtonIconAndCaption .OnAction = "Sheet1.CommandButton2_Click" .BeginGroup = True .FaceId = 38 End With With CommandBars("Assembly Test").Controls.Add .Caption = "Add Sub-Test Condition" .Style = msoButtonIconAndCaption .OnAction = "Sheet1.CommandButton3_Click" .BeginGroup = True .FaceId = 38 End With With CommandBars("Assembly Test").Controls.Add .Caption = "Add Page Divider Row" .Style = msoButtonIconAndCaption .OnAction = "Sheet1.CommandButton4_Click" .BeginGroup = True .FaceId = 112 End With With CommandBars("Assembly Test").Controls.Add .Caption = "Delete" .Style = msoButtonIconAndCaption .OnAction = "Sheet1.CommandButton5_Click" .BeginGroup = True .FaceId = 67 End With End Su -- SSjmg247 ----------------------------------------------------------------------- SSjmg2477's Profile: http://www.excelforum.com/member.php...fo&userid=3153 View this thread: http://www.excelforum.com/showthread.php?threadid=51223 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
"Object Variable or With Block Variable Not Set" error help request | Excel Programming | |||
Run-time error '91': "Object variable or With block variable not set | Excel Programming | |||
Cells.Find error Object variable or With block variable not set | Excel Programming | |||
"Run-time error 91: Object variable or With block not set" | Excel Programming | |||
Ogilvy Help :) - "Object variable or With block variable not set" | Excel Programming |