Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Get floating CommandBar position

After I manually move my custom command bar to the place I want it, is there
a command I can type in the immediate window to get the .Top and .Left
positions?

Thanks,

Patti


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Get floating CommandBar position

"Patti" wrote in message
...
After I manually move my custom command bar to the place I want it, is
there a command I can type in the immediate window to get the .Top and
.Left positions?


Hi Patti,

Here's one way to do it:

? CommandBars("YourBarName").Top
? CommandBars("YourBarName").Left

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Get floating CommandBar position

Hi Rob,

When I try that, I get a compile error: "Expected variable or procedure,
not module". I have tried both ? commandbars(myapp).top and ?
commandbars("My Toolbar").top.

Partial code - pinched from Bob Phillips - follows. Any ideas?

Thanks!

Patti


Private Sub Workbook_Open()
'Bob Phillips
Dim oCB As CommandBar

appMenu = "My Toolbar"

On Error Resume Next
Application.CommandBars(appMenu).Delete
On Error GoTo 0

Set oCB = Application.CommandBars.Add(Name:=appMenu,
Position:=msoBarFloating, temporary:=True)

With oCB
With .Controls.Add(Type:=msoControlButton)
.Caption = appMenu & " Toolbar"
.Style = msoButtonCaption
End With
'.
'. ' more controls added
'.
.Visible = True
End With
End Sub





"Rob Bovey" wrote in message
...
"Patti" wrote in message
...
After I manually move my custom command bar to the place I want it, is
there a command I can type in the immediate window to get the .Top and
.Left positions?


Hi Patti,

Here's one way to do it:

? CommandBars("YourBarName").Top
? CommandBars("YourBarName").Left

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Get floating CommandBar position

Did you try Rob's suggestion after you ran Bob's code?

I included Rob's suggestion into Bob's code and it still worked.

Option Explicit
Private Sub Workbook_Open()
'Bob Phillips
Dim oCB As CommandBar
Dim appMenu As String

appMenu = "My Toolbar"

On Error Resume Next
Application.CommandBars(appMenu).Delete
On Error GoTo 0

Set oCB = Application.CommandBars.Add(Name:=appMenu, _
Position:=msoBarFloating, temporary:=True)

With oCB
With .Controls.Add(Type:=msoControlButton)
.Caption = appMenu & " Toolbar"
.Style = msoButtonCaption
End With
'.
'. ' more controls added
'.
.Visible = True
MsgBox .Top & vbLf & .Left
End With

End Sub

Patti wrote:

Hi Rob,

When I try that, I get a compile error: "Expected variable or procedure,
not module". I have tried both ? commandbars(myapp).top and ?
commandbars("My Toolbar").top.

Partial code - pinched from Bob Phillips - follows. Any ideas?

Thanks!

Patti

Private Sub Workbook_Open()
'Bob Phillips
Dim oCB As CommandBar

appMenu = "My Toolbar"

On Error Resume Next
Application.CommandBars(appMenu).Delete
On Error GoTo 0

Set oCB = Application.CommandBars.Add(Name:=appMenu,
Position:=msoBarFloating, temporary:=True)

With oCB
With .Controls.Add(Type:=msoControlButton)
.Caption = appMenu & " Toolbar"
.Style = msoButtonCaption
End With
'.
'. ' more controls added
'.
.Visible = True
End With
End Sub

"Rob Bovey" wrote in message
...
"Patti" wrote in message
...
After I manually move my custom command bar to the place I want it, is
there a command I can type in the immediate window to get the .Top and
.Left positions?


Hi Patti,

Here's one way to do it:

? CommandBars("YourBarName").Top
? CommandBars("YourBarName").Left

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm



--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Get floating CommandBar position

"Patti" wrote in message
...
Hi Rob,

When I try that, I get a compile error: "Expected variable or procedure,
not module". I have tried both ? commandbars(myapp).top and ?
commandbars("My Toolbar").top.


Hi Patti,

It sounds like you've named one of your code modules CommandBars. This
is confusing VBA because it thinks you're trying to reference a procedure in
that module. Rename the module to something like MCommandBars and try it
again.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CommandBar swiederkehr Excel Programming 5 July 19th 05 04:58 PM
Adjust position of a commandbar quartz[_2_] Excel Programming 1 March 11th 05 06:53 AM
commandbar Greg Prost[_2_] Excel Programming 2 November 21st 03 11:42 AM
commandbar hunt defj Excel Programming 2 November 17th 03 11:40 PM
Moving CommandBar using VBA or C# Aaron Queenan Excel Programming 1 October 31st 03 03:20 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"