Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Animating a Menu Bar

Hi. I want to animate a menu bar that is floating in Excel and flies in from
left to right.

This is the code where I attemped to do it, but the screen isn't updated
properly.
How can I have a better visual look here. Thanks for helping.

CODE SNIPPET:
------------------



Sub MENU_Makro3()
Dim myBar As CommandBar
Dim i As Integer
'
Set myBar = CommandBars("My Menu")
With myBar
.Position = msoBarFloating
.Top = 245
' Wants to animate the menu bar flying in from Left
For i = 35 To 600
.Left = i
Next i
End With
' Unfortuneately you can hardly se the Menu Bar moving. Why is that???
End Sub


Regards
Jan


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Animating a Menu Bar

This is better:

Sub MENU_Makro3()
Dim myBar As CommandBar
Dim i As Integer
Set myBar = CommandBars("My Menu")
With myBar
.Position = msoBarFloating
.Top = 245
DoEvents
For i = 35 To 600
.Left = i
DoEvents
Next i
End With
End Sub


--
Jim
"Jan G. Thorstensen" wrote in message
...
Hi. I want to animate a menu bar that is floating in Excel and flies in
from left to right.

This is the code where I attemped to do it, but the screen isn't updated
properly.
How can I have a better visual look here. Thanks for helping.

CODE SNIPPET:
------------------



Sub MENU_Makro3()
Dim myBar As CommandBar
Dim i As Integer
'
Set myBar = CommandBars("My Menu")
With myBar
.Position = msoBarFloating
.Top = 245
' Wants to animate the menu bar flying in from Left
For i = 35 To 600
.Left = i
Next i
End With
' Unfortuneately you can hardly se the Menu Bar moving. Why is that???
End Sub


Regards
Jan



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Animating a Menu Bar

I think your menu is just not having enough time to redraw itself.
Play with the iPauseTime to adjust how fast the menu moves. I also
added a Step in your For..Next statement that can adjust the speed of
the animation.

Sub MENU_Makro3()
Dim myBar As CommandBar
Dim i As Integer
Dim iPauseTime
Dim iStart

iPauseTime = 0.01
Set myBar = CommandBars("My Menu")
With myBar
.Position = msoBarFloating
.Top = 245
' Wants to animate the menu bar flying in from Left

For i = 35 To 600 Step 4
iStart = Timer
Do While Timer < iStart + iPauseTime
DoEvents ' Yield to other processes.
Loop
.Left = i
Next i
End With
End Sub
Regards
Jan


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Animating a Menu Bar

Thanks a lot, Jim Rech. That did the trick!

Jan



"Jim Rech" skrev i melding
...
This is better:

Sub MENU_Makro3()
Dim myBar As CommandBar
Dim i As Integer
Set myBar = CommandBars("My Menu")
With myBar
.Position = msoBarFloating
.Top = 245
DoEvents
For i = 35 To 600
.Left = i
DoEvents
Next i
End With
End Sub


--
Jim
"Jan G. Thorstensen" wrote in message
...
Hi. I want to animate a menu bar that is floating in Excel and flies in
from left to right.

This is the code where I attemped to do it, but the screen isn't updated
properly.
How can I have a better visual look here. Thanks for helping.

CODE SNIPPET:
------------------



Sub MENU_Makro3()
Dim myBar As CommandBar
Dim i As Integer
'
Set myBar = CommandBars("My Menu")
With myBar
.Position = msoBarFloating
.Top = 245
' Wants to animate the menu bar flying in from Left
For i = 35 To 600
.Left = i
Next i
End With
' Unfortuneately you can hardly se the Menu Bar moving. Why is that???
End Sub


Regards
Jan





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
Drop dwn menu. Formula to count selection frm menu in anoth cell? ggoldber Excel Worksheet Functions 1 June 4th 08 02:21 PM
Menu items added with menu item editor in older versions Michael Hoffmann Excel Discussion (Misc queries) 2 January 7th 05 01:40 PM
Adding a menu item right click menu when clicking on a single. Andoni[_28_] Excel Programming 0 September 2nd 04 10:23 PM
Custom Menu return to Excel Menu upon Closing VetcalcReport Excel Programming 2 August 2nd 04 02:59 PM
Free animating ActiveX control Ben Taylor Excel Programming 0 July 21st 03 11:00 AM


All times are GMT +1. The time now is 11:27 PM.

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"