Run-time error '91':
Object variable or With block variable not set
Dim myBlankBtn As Object
Dim myCustomBar As Object
Dim myControl As Object
Set myCustomBar = CommandBars("Custom")
Set myControl = CommandBars("Standard").Controls(1)
myControl.Copy Bar:=myCustomBar, Before:=1
Set myBlankBtn = CommandBars("Custom").Controls.Add
Option Explicit
Private Sub Form_Load()
Dim myBlankBtn As Object
Dim myCustomBar As Object
Dim myControl As Object
Set myCustomBar = CommandBars("Custom")
Set myControl = CommandBars("Standard").Controls(1)
myControl.Copy Bar:=myCustomBar, Before:=1
Set myBlankBtn = CommandBars("Custom").Controls.Add
End Sub
Option Explicit
Private wrd As New Word.Application
Private Sub Form_Load()
Dim myBlankBtn As Object
Dim myCustomBar As Object
Dim myControl As Object
wrd.Visible = True
Set myCustomBar = wrd.CommandBars(1)
Set myControl = wrd.CommandBars(1).Controls(1)
myControl.Copy Bar:=myCustomBar, Before:=1
Set myBlankBtn = wrd.CommandBars(2).Controls.Add
End Sub
Private xl as New Excel.Application
dim myCustomBar as commandbar
set mycustombar=commandbars.add
with mycustombar
.name="Custom"
commandbars("standard").controls(1).copy mycustombar
.controls.add
end with
Object variable or With block variable not set
: ActionControl : Nothing : CommandBarControl :
Сейчас этот форум просматривают: Yandex-бот и гости: 57