ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Declaring Variable as VBConstant (https://www.excelbanter.com/excel-programming/298384-declaring-variable-vbconstant.html)

The Vision Thing

Declaring Variable as VBConstant
 
I've using the following to call a proc. to create a custom toolbar. But
I'm uncertain as to what to dim the variable vbPosition as, as I'm assigning
it the vb constant msoBarTop.

Sub Test()
Dim arrToolCaption As Variant, arrToolMacro As Variant, strDelimiter As
String, vbPosition As Variant
arrToolCaption = Array("Tool1", "Tool2", "Tool3", "Tool4")
arrToolMacro = Array("Macro1", "Macro2", "Macro3", "Macro4")
strDelimiter = " |"
vbPosition = msoBarTop
CreateToolbar arrToolCaption, arrToolMacro, strDelimiter, vbPosition
End Sub

Thanks,
Wayne C.





Jon Peltier[_7_]

Declaring Variable as VBConstant
 
Wayne -

According to VBA Help:

Add Method

Creates a new command bar and adds it to the collection of command bars.
Returns a CommandBar object.

expression.Add(Name, Position, MenuBar, Temporary)

expression Required. An expression that returns a CommandBars object.

Name Optional Variant. The name of the new command bar. If this
argument is omitted, a default name is assigned to the command bar (such
as Custom 1).

Position Optional Variant. The position or type of the new command bar.
Can be one of the MsoBarPosition constants listed in the following table.

Constant Description

msoBarLeft, msoBarTop, msoBarRight, msoBarBottom Indicates the left,
top, right, and bottom coordinates of the new command bar

msoBarFloating Indicates that the new command bar won't be docked

msoBarPopup Indicates that the new command bar will be a shortcut menu

msoBarMenuBar Macintosh only

MenuBar Optional Variant. True to replace the active menu bar with the
new command bar. The default value is False.

Temporary Optional Variant. True to make the new command bar temporary.
Temporary command bars are deleted when the container application is
closed. The default value is False.


- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______



The Vision Thing wrote:

I've using the following to call a proc. to create a custom toolbar. But
I'm uncertain as to what to dim the variable vbPosition as, as I'm assigning
it the vb constant msoBarTop.

Sub Test()
Dim arrToolCaption As Variant, arrToolMacro As Variant, strDelimiter As
String, vbPosition As Variant
arrToolCaption = Array("Tool1", "Tool2", "Tool3", "Tool4")
arrToolMacro = Array("Macro1", "Macro2", "Macro3", "Macro4")
strDelimiter = " |"
vbPosition = msoBarTop
CreateToolbar arrToolCaption, arrToolMacro, strDelimiter, vbPosition
End Sub

Thanks,
Wayne C.






The Vision Thing

Declaring Variable as VBConstant
 
Thanks Jon.

"Jon Peltier" wrote in message
...
Wayne -

According to VBA Help:

Add Method

Creates a new command bar and adds it to the collection of command bars.
Returns a CommandBar object.

expression.Add(Name, Position, MenuBar, Temporary)

expression Required. An expression that returns a CommandBars object.

Name Optional Variant. The name of the new command bar. If this
argument is omitted, a default name is assigned to the command bar (such
as Custom 1).

Position Optional Variant. The position or type of the new command bar.
Can be one of the MsoBarPosition constants listed in the following table.

Constant Description

msoBarLeft, msoBarTop, msoBarRight, msoBarBottom Indicates the left,
top, right, and bottom coordinates of the new command bar

msoBarFloating Indicates that the new command bar won't be docked

msoBarPopup Indicates that the new command bar will be a shortcut menu

msoBarMenuBar Macintosh only

MenuBar Optional Variant. True to replace the active menu bar with the
new command bar. The default value is False.

Temporary Optional Variant. True to make the new command bar temporary.
Temporary command bars are deleted when the container application is
closed. The default value is False.


- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______



The Vision Thing wrote:

I've using the following to call a proc. to create a custom toolbar.

But
I'm uncertain as to what to dim the variable vbPosition as, as I'm

assigning
it the vb constant msoBarTop.

Sub Test()
Dim arrToolCaption As Variant, arrToolMacro As Variant, strDelimiter

As
String, vbPosition As Variant
arrToolCaption = Array("Tool1", "Tool2", "Tool3", "Tool4")
arrToolMacro = Array("Macro1", "Macro2", "Macro3", "Macro4")
strDelimiter = " |"
vbPosition = msoBarTop
CreateToolbar arrToolCaption, arrToolMacro, strDelimiter, vbPosition
End Sub

Thanks,
Wayne C.









All times are GMT +1. The time now is 05:30 PM.

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