Gradually Expand a Form (Animated Open)

IndyTF

New Member
Joined
Oct 23, 2008
Messages
19
Hey all. I've used this code in Access 2002/3 for some time and it has always worked just fine. It basically uses a timer to see how fast your computer is running through the code to ensure that it takes all computers the same amount of time to expand or animate the form's opening.

However, it doesn't seem to be working in Access 2007. The form is still opening, but it isn't gradually expanding it - it is just waiting the .35 seconds (or whatever you put in there) and then showing the form. Any ideas?

Code:
[SIZE="2"]Private Sub lbl_MainMenu_Click()

Dim start As Double
Dim lasttime As Double
Dim timeleft As Double
Dim lstart As Double
Dim lend As Double

start = Timer

Dim wait As Double
Dim hleft As Double
Dim wleft As Double
Dim totheight As Double
Dim totwidth As Double

wait = 0.35

If (Me.sub_Main_Menu.Visible) Then
    Me.sub_Main_Menu.Visible = False
Else
    Me.sub_Main_Menu.Visible = True
    Me.sub_Main_Menu.Height = 0.0938 * 1439
    Me.sub_Main_Menu.Width = 0.0938 * 1439
    Me.sub_Main_Menu.Visible = True
    totheight = 2.7917 * 1439
    totwidth = 4.5 * 1439
    Me.sub_Main_Menu.Visible = True
    lstart = Timer
    lend = Timer + 0.01
    Do While (Timer < start + wait) And ((Me.sub_Main_Menu.Height < totheight) Or (Me.sub_Main_Menu.Width < totwidth))
        lasttime = lend - lstart
        lstart = Timer
        timeleft = start + wait - Timer
        hleft = totheight - Me.sub_Main_Menu.Height
        wleft = totwidth - Me.sub_Main_Menu.Width
        Me.sub_Main_Menu.Height = Me.sub_Main_Menu.Height + ((lasttime / timeleft) * hleft)
        Me.sub_Main_Menu.Width = Me.sub_Main_Menu.Width + ((lasttime / timeleft) * wleft)
        lend = Timer
    Loop
    Me.sub_Main_Menu.Height = totheight
    Me.sub_Main_Menu.Width = totwidth
End If

End Sub[/SIZE]
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Forum statistics

Threads
1,214,973
Messages
6,122,534
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top