PC Review


Reply
Thread Tools Rate Thread

Center Toolbar

 
 
Zone
Guest
Posts: n/a
 
      31st Mar 2007
When my workbook opens, I make all commandbars invisible except the
standard menubar and the workbook's custom toolbar. I have the custom
toolbar in the right place vertically (just below the menubar). How
do I center it horizontally? TIA, James

 
Reply With Quote
 
 
 
 
Zone
Guest
Posts: n/a
 
      31st Mar 2007
On Mar 31, 12:22�pm, "Zone" <jkend69...@aol.com> wrote:
> When my workbook opens, I make all commandbars invisible except the
> standard menubar and the workbook's custom toolbar. *I have the custom
> toolbar in the right place vertically (just below the menubar). *How
> do I center it horizontally? *TIA, James


I mean, I want VBA to center my toolbar. J

 
Reply With Quote
 
Helmut Weber
Guest
Posts: n/a
 
      31st Mar 2007
Hi James,

>When my workbook opens, I make all commandbars invisible except the
>standard menubar and the workbook's custom toolbar. I have the custom
>toolbar in the right place vertically (just below the menubar). How
>do I center it horizontally? TIA, James


for centering a toolbar:

Sub TestCenter()
Dim x As Long
Dim v As Long
v = Application.CommandBars("formatting").Width
x = System.HorizontalResolution
Application.CommandBars("formatting").Left = x / 2 - v / 2
End Sub

Though occasionally,
System.HorizontalResolution tells me,
that an ActiveX object could not be created.
Why? I don't know.
--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

 
Reply With Quote
 
Zone
Guest
Posts: n/a
 
      31st Mar 2007
On Mar 31, 2:51�pm, Helmut Weber <nbhymsjxd...@mailinator.com> wrote:

Helmut, line
x = System.HorizontalResolution
gives me run-time error 424, object required. I am using Excel 2002
on Windows XP. James

> Hi James,
>
> >When my workbook opens, I make all commandbars invisible except the
> >standard menubar and the workbook's custom toolbar. *I have the custom
> >toolbar in the right place vertically (just below the menubar). *How
> >do I center it horizontally? *TIA, James

>
> for centering a toolbar:
>
> Sub TestCenter()
> Dim x As Long
> Dim v As Long
> v = Application.CommandBars("formatting").Width
> x = System.HorizontalResolution
> Application.CommandBars("formatting").Left = x / 2 - v / 2
> End Sub
>
> Though occasionally,
> System.HorizontalResolution tells me,
> that an ActiveX object could not be created.
> Why? I don't know.
> --
> Greetings from Bavaria, Germany
>
> Helmut Weber, MVP WordVBA
>
> Win XP, Office 2003
> "red.sys" & Chr$(64) & "t-online.de"



 
Reply With Quote
 
Helmut Weber
Guest
Posts: n/a
 
      31st Mar 2007
Hi James,

there must be a bug in it.
I got the same message a few times,
then it disappeared.

I never get it in Word.

If the macro is just for you,
you may try it with 1024 or 1200 or whatever.

And it applies to a maximized window.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"


 
Reply With Quote
 
Zone
Guest
Posts: n/a
 
      31st Mar 2007
On Mar 31, 3:17?pm, Helmut Weber <nbhymsjxd...@mailinator.com> wrote:
Danka, Helmut, and hallo to beautiful Bavaria. I'm using a wide-
screen laptop, if that makes any difference. I will try your
suggestion. J

> Hi James,
>
> there must be a bug in it.
> I got the same message a few times,
> then it disappeared.
>
> I never get it in Word.
>
> If the macro is just for you,
> you may try it with 1024 or 1200 or whatever.
>
> And it applies to a maximized window.
>
> --
> Greetings from Bavaria, Germany
>
> Helmut Weber, MVP WordVBA
>
> Win XP, Office 2003
> "red.sys" & Chr$(64) & "t-online.de"



 
Reply With Quote
 
Zone
Guest
Posts: n/a
 
      31st Mar 2007
Helmut, this works fine:
Sub TestCenterJ()
Dim WideScr As Variant
Dim x As Long
Dim v As Long
v = Application.CommandBars("formatting").Width
WideScr = MsgBox("Wide screen?", vbYesNo)
If WideScr = vbYes Then
x = 1325
Else
x = 1024
End If
Application.CommandBars("formatting").Left = x / 2 - v / 2
End Sub
Of course, the problem is the program should be able to automatically
gather this screen horiz center information. Since your
System.HorizontalResolution won't work for me (Excel 2002), I'm at a
loss. Having to ask the user for this info is really embarrassing!
James
On Mar 31, 3:33�pm, "Zone" <jkend69...@aol.com> wrote:
> On Mar 31, 3:17?pm, Helmut Weber <nbhymsjxd...@mailinator.com> wrote:
> Danka, Helmut, and hallo to beautiful Bavaria. *I'm using a wide-
> screen laptop, if that makes any difference. *I will try your
> suggestion. *J
>
>
>
> > Hi James,

>
> > there must be a bug in it.
> > I got the same message a few times,
> > then it disappeared.

>
> > I never get it in Word.

>
> > If the macro is just for you,
> > you may try it with 1024 or 1200 or whatever.

>
> > And it applies to a maximized window.

>
> > --
> > Greetings from Bavaria, Germany

>
> > Helmut Weber, MVP WordVBA

>
> > Win XP, Office 2003
> > "red.sys" & Chr$(64) & "t-online.de"- Hide quoted text -

>
> - Show quoted text -



 
Reply With Quote
 
Helmut Weber
Guest
Posts: n/a
 
      31st Mar 2007
Hi Zone,

if for professional use:

Option Explicit
Declare Function GetSystemMetrics Lib "user32" _
(ByVal nIndex As Long) As Long

Sub Test()
MsgBox GetSystemMetrics(16)
End Sub

HTH

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
Reply With Quote
 
Zone
Guest
Posts: n/a
 
      31st Mar 2007
Helmut, The msgbox displays 1280 on my wide-screen laptop. Would you
happen to know whether this is pixels or points? J
On Mar 31, 4:20?pm, Helmut Weber <nbhymsjxd...@mailinator.com> wrote:
> Hi Zone,
>
> if for professional use:
>
> Option Explicit
> Declare Function GetSystemMetrics Lib "user32" _
> (ByVal nIndex As Long) As Long
>
> Sub Test()
> MsgBox GetSystemMetrics(16)
> End Sub
>
> HTH
>
> --
> Greetings from Bavaria, Germany
>
> Helmut Weber, MVP WordVBA
>
> Win XP, Office 2003
> "red.sys" & Chr$(64) & "t-online.de"



 
Reply With Quote
 
Darren Hill
Guest
Posts: n/a
 
      31st Mar 2007
That will be pixels.
Your screen must have a resolution of 1280x800.

Darren
On Sat, 31 Mar 2007 22:06:38 +0100, Zone <(E-Mail Removed)> wrote:

> Helmut, The msgbox displays 1280 on my wide-screen laptop. Would you
> happen to know whether this is pixels or points? J
> On Mar 31, 4:20?pm, Helmut Weber <nbhymsjxd...@mailinator.com> wrote:
>> Hi Zone,
>>
>> if for professional use:
>>
>> Option Explicit
>> Declare Function GetSystemMetrics Lib "user32" _
>> (ByVal nIndex As Long) As Long
>>
>> Sub Test()
>> MsgBox GetSystemMetrics(16)
>> End Sub
>>
>> HTH
>>
>> --
>> Greetings from Bavaria, Germany
>>
>> Helmut Weber, MVP WordVBA
>>
>> Win XP, Office 2003
>> "red.sys" & Chr$(64) & "t-online.de"

>
>




--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
TOOLBAR button or Keyboard Shortcut FOR Center Across Selection?? RajenRajput1 Microsoft Excel Misc 13 29th Apr 2008 07:30 PM
shortcut to center text other than format toolbar? =?Utf-8?B?cmRhdmlh?= Microsoft Excel Misc 2 5th May 2005 03:54 PM
Media Center Toolbar Button Missing on IE Standard Toolbar =?Utf-8?B?YWxmMzBh?= Windows XP Internet Explorer 3 19th Dec 2004 04:51 PM
How to Enable merge and center icon on the formating toolbar? =?Utf-8?B?SnlvdGhp?= Microsoft Excel Misc 1 29th Sep 2004 02:19 PM
VS.NET 2003 Windows Toolbar: How to center text without image? Mark Overstreet Microsoft Dot NET Framework Forms 1 10th Feb 2004 10:21 PM


Features
 

Advertising
 

Newsgroups
 


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