PC Review


Reply
 
 
MAX
Guest
Posts: n/a
 
      29th Mar 2009
I have an animated excel file with a picture rolling from left to right of
the screen. The is done when I click on the picture. My first problem is that
the picture rolls very fast and I want to reduce its speed, and the second
problem is that I want this animation not when I click on the picture but
when I open the file. I am using Excel 2007 and below is the code that I am
using. Any help.

Thanks.

Code:

Sub StartDemo1()
On Error Resume Next
Set OldCell = ActiveCell
ActiveSheet.Shapes("Picture 1").Select
For i = 0 To 360 Step 3
Selection.ShapeRange.IncrementRotation 15
Selection.ShapeRange.Left = Selection.ShapeRange.Left + 10
Selection.ShapeRange.Top = Selection.ShapeRange.Top - 0.1
DoEvents
Next i

For i = 360 To 0 Step -6
Selection.ShapeRange.IncrementRotation -15
Selection.ShapeRange.Left = Selection.ShapeRange.Left - 20
Selection.ShapeRange.Top = Selection.ShapeRange.Top + 0.1
DoEvents
Next i
Selection.ShapeRange.Top = 300
Selection.ShapeRange.Left = 42
OldCell.Select
End Sub

 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      29th Mar 2009
1. For making it slow use a timer in betwen the For loop. Adjust the seconds
as needed
Application.Wait Now + TimeValue("00:00:05")

2. If you want this to happen during open write the code in Workbook_Open()
event

If this post helps click Yes
---------------
Jacob Skaria


"MAX" wrote:

> I have an animated excel file with a picture rolling from left to right of
> the screen. The is done when I click on the picture. My first problem is that
> the picture rolls very fast and I want to reduce its speed, and the second
> problem is that I want this animation not when I click on the picture but
> when I open the file. I am using Excel 2007 and below is the code that I am
> using. Any help.
>
> Thanks.
>
> Code:
>
> Sub StartDemo1()
> On Error Resume Next
> Set OldCell = ActiveCell
> ActiveSheet.Shapes("Picture 1").Select
> For i = 0 To 360 Step 3
> Selection.ShapeRange.IncrementRotation 15
> Selection.ShapeRange.Left = Selection.ShapeRange.Left + 10
> Selection.ShapeRange.Top = Selection.ShapeRange.Top - 0.1
> DoEvents
> Next i
>
> For i = 360 To 0 Step -6
> Selection.ShapeRange.IncrementRotation -15
> Selection.ShapeRange.Left = Selection.ShapeRange.Left - 20
> Selection.ShapeRange.Top = Selection.ShapeRange.Top + 0.1
> DoEvents
> Next i
> Selection.ShapeRange.Top = 300
> Selection.ShapeRange.Left = 42
> OldCell.Select
> End Sub
>

 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      29th Mar 2009
Max,

application.wait is a bit of a blunt instrument so try this instead

Alt+F11 to open VB editor, right click 'ThisWorkbook' and insert module and
paste the code below in. In each of the 2 loops in your code add the line

wait(0.08)

the 0.08 gave me a nice smooth scroll but you can play with this.

Sub Wait(DelaySecs As Single)
Dim sngSec As Single
EndDelay = Timer + DelaySecs
Do While Timer < EndDelay
DoEvents
Loop
End Sub

Mike

"MAX" wrote:

> I have an animated excel file with a picture rolling from left to right of
> the screen. The is done when I click on the picture. My first problem is that
> the picture rolls very fast and I want to reduce its speed, and the second
> problem is that I want this animation not when I click on the picture but
> when I open the file. I am using Excel 2007 and below is the code that I am
> using. Any help.
>
> Thanks.
>
> Code:
>
> Sub StartDemo1()
> On Error Resume Next
> Set OldCell = ActiveCell
> ActiveSheet.Shapes("Picture 1").Select
> For i = 0 To 360 Step 3
> Selection.ShapeRange.IncrementRotation 15
> Selection.ShapeRange.Left = Selection.ShapeRange.Left + 10
> Selection.ShapeRange.Top = Selection.ShapeRange.Top - 0.1
> DoEvents
> Next i
>
> For i = 360 To 0 Step -6
> Selection.ShapeRange.IncrementRotation -15
> Selection.ShapeRange.Left = Selection.ShapeRange.Left - 20
> Selection.ShapeRange.Top = Selection.ShapeRange.Top + 0.1
> DoEvents
> Next i
> Selection.ShapeRange.Top = 300
> Selection.ShapeRange.Left = 42
> OldCell.Select
> End Sub
>

 
Reply With Quote
 
MAX
Guest
Posts: n/a
 
      29th Mar 2009
Will you please tell me where I am going to put wait(0.08) because I'm a
beginer in VB.

"Mike H" wrote:

> Max,
>
> application.wait is a bit of a blunt instrument so try this instead
>
> Alt+F11 to open VB editor, right click 'ThisWorkbook' and insert module and
> paste the code below in. In each of the 2 loops in your code add the line
>
> wait(0.08)
>
> the 0.08 gave me a nice smooth scroll but you can play with this.
>
> Sub Wait(DelaySecs As Single)
> Dim sngSec As Single
> EndDelay = Timer + DelaySecs
> Do While Timer < EndDelay
> DoEvents
> Loop
> End Sub
>
> Mike
>
> "MAX" wrote:
>
> > I have an animated excel file with a picture rolling from left to right of
> > the screen. The is done when I click on the picture. My first problem is that
> > the picture rolls very fast and I want to reduce its speed, and the second
> > problem is that I want this animation not when I click on the picture but
> > when I open the file. I am using Excel 2007 and below is the code that I am
> > using. Any help.
> >
> > Thanks.
> >
> > Code:
> >
> > Sub StartDemo1()
> > On Error Resume Next
> > Set OldCell = ActiveCell
> > ActiveSheet.Shapes("Picture 1").Select
> > For i = 0 To 360 Step 3
> > Selection.ShapeRange.IncrementRotation 15
> > Selection.ShapeRange.Left = Selection.ShapeRange.Left + 10
> > Selection.ShapeRange.Top = Selection.ShapeRange.Top - 0.1
> > DoEvents
> > Next i
> >
> > For i = 360 To 0 Step -6
> > Selection.ShapeRange.IncrementRotation -15
> > Selection.ShapeRange.Left = Selection.ShapeRange.Left - 20
> > Selection.ShapeRange.Top = Selection.ShapeRange.Top + 0.1
> > DoEvents
> > Next i
> > Selection.ShapeRange.Top = 300
> > Selection.ShapeRange.Left = 42
> > OldCell.Select
> > End Sub
> >

 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      29th Mar 2009
Max,

Modify your code like this and note the 2 added lines

Sub StartDemo1()
On Error Resume Next
Set OldCell = ActiveCell
ActiveSheet.Shapes("Picture 1").Select
For i = 0 To 360 Step 3
Wait (0.08)
Selection.ShapeRange.IncrementRotation 15
Selection.ShapeRange.Left = Selection.ShapeRange.Left + 10
Selection.ShapeRange.Top = Selection.ShapeRange.Top - 0.1
DoEvents
Next i

For i = 360 To 0 Step -6
Wait (0.08)
Selection.ShapeRange.IncrementRotation -15
Selection.ShapeRange.Left = Selection.ShapeRange.Left - 20
Selection.ShapeRange.Top = Selection.ShapeRange.Top + 0.1
DoEvents
Next i
Selection.ShapeRange.Top = 300
Selection.ShapeRange.Left = 42
OldCell.Select
End Sub

Mike

"MAX" wrote:

> Will you please tell me where I am going to put wait(0.08) because I'm a
> beginer in VB.
>
> "Mike H" wrote:
>
> > Max,
> >
> > application.wait is a bit of a blunt instrument so try this instead
> >
> > Alt+F11 to open VB editor, right click 'ThisWorkbook' and insert module and
> > paste the code below in. In each of the 2 loops in your code add the line
> >
> > wait(0.08)
> >
> > the 0.08 gave me a nice smooth scroll but you can play with this.
> >
> > Sub Wait(DelaySecs As Single)
> > Dim sngSec As Single
> > EndDelay = Timer + DelaySecs
> > Do While Timer < EndDelay
> > DoEvents
> > Loop
> > End Sub
> >
> > Mike
> >
> > "MAX" wrote:
> >
> > > I have an animated excel file with a picture rolling from left to right of
> > > the screen. The is done when I click on the picture. My first problem is that
> > > the picture rolls very fast and I want to reduce its speed, and the second
> > > problem is that I want this animation not when I click on the picture but
> > > when I open the file. I am using Excel 2007 and below is the code that I am
> > > using. Any help.
> > >
> > > Thanks.
> > >
> > > Code:
> > >
> > > Sub StartDemo1()
> > > On Error Resume Next
> > > Set OldCell = ActiveCell
> > > ActiveSheet.Shapes("Picture 1").Select
> > > For i = 0 To 360 Step 3
> > > Selection.ShapeRange.IncrementRotation 15
> > > Selection.ShapeRange.Left = Selection.ShapeRange.Left + 10
> > > Selection.ShapeRange.Top = Selection.ShapeRange.Top - 0.1
> > > DoEvents
> > > Next i
> > >
> > > For i = 360 To 0 Step -6
> > > Selection.ShapeRange.IncrementRotation -15
> > > Selection.ShapeRange.Left = Selection.ShapeRange.Left - 20
> > > Selection.ShapeRange.Top = Selection.ShapeRange.Top + 0.1
> > > DoEvents
> > > Next i
> > > Selection.ShapeRange.Top = 300
> > > Selection.ShapeRange.Left = 42
> > > OldCell.Select
> > > End Sub
> > >

 
Reply With Quote
 
MAX
Guest
Posts: n/a
 
      29th Mar 2009
Thanks a lot

"Mike H" wrote:

> Max,
>
> Modify your code like this and note the 2 added lines
>
> Sub StartDemo1()
> On Error Resume Next
> Set OldCell = ActiveCell
> ActiveSheet.Shapes("Picture 1").Select
> For i = 0 To 360 Step 3
> Wait (0.08)
> Selection.ShapeRange.IncrementRotation 15
> Selection.ShapeRange.Left = Selection.ShapeRange.Left + 10
> Selection.ShapeRange.Top = Selection.ShapeRange.Top - 0.1
> DoEvents
> Next i
>
> For i = 360 To 0 Step -6
> Wait (0.08)
> Selection.ShapeRange.IncrementRotation -15
> Selection.ShapeRange.Left = Selection.ShapeRange.Left - 20
> Selection.ShapeRange.Top = Selection.ShapeRange.Top + 0.1
> DoEvents
> Next i
> Selection.ShapeRange.Top = 300
> Selection.ShapeRange.Left = 42
> OldCell.Select
> End Sub
>
> Mike
>
> "MAX" wrote:
>
> > Will you please tell me where I am going to put wait(0.08) because I'm a
> > beginer in VB.
> >
> > "Mike H" wrote:
> >
> > > Max,
> > >
> > > application.wait is a bit of a blunt instrument so try this instead
> > >
> > > Alt+F11 to open VB editor, right click 'ThisWorkbook' and insert module and
> > > paste the code below in. In each of the 2 loops in your code add the line
> > >
> > > wait(0.08)
> > >
> > > the 0.08 gave me a nice smooth scroll but you can play with this.
> > >
> > > Sub Wait(DelaySecs As Single)
> > > Dim sngSec As Single
> > > EndDelay = Timer + DelaySecs
> > > Do While Timer < EndDelay
> > > DoEvents
> > > Loop
> > > End Sub
> > >
> > > Mike
> > >
> > > "MAX" wrote:
> > >
> > > > I have an animated excel file with a picture rolling from left to right of
> > > > the screen. The is done when I click on the picture. My first problem is that
> > > > the picture rolls very fast and I want to reduce its speed, and the second
> > > > problem is that I want this animation not when I click on the picture but
> > > > when I open the file. I am using Excel 2007 and below is the code that I am
> > > > using. Any help.
> > > >
> > > > Thanks.
> > > >
> > > > Code:
> > > >
> > > > Sub StartDemo1()
> > > > On Error Resume Next
> > > > Set OldCell = ActiveCell
> > > > ActiveSheet.Shapes("Picture 1").Select
> > > > For i = 0 To 360 Step 3
> > > > Selection.ShapeRange.IncrementRotation 15
> > > > Selection.ShapeRange.Left = Selection.ShapeRange.Left + 10
> > > > Selection.ShapeRange.Top = Selection.ShapeRange.Top - 0.1
> > > > DoEvents
> > > > Next i
> > > >
> > > > For i = 360 To 0 Step -6
> > > > Selection.ShapeRange.IncrementRotation -15
> > > > Selection.ShapeRange.Left = Selection.ShapeRange.Left - 20
> > > > Selection.ShapeRange.Top = Selection.ShapeRange.Top + 0.1
> > > > DoEvents
> > > > Next i
> > > > Selection.ShapeRange.Top = 300
> > > > Selection.ShapeRange.Left = 42
> > > > OldCell.Select
> > > > End Sub
> > > >

 
Reply With Quote
 
MAX
Guest
Posts: n/a
 
      29th Mar 2009
Very nice timing, but although I put the the code in the workbook I have
still to click on the picture for the animation, I want this when I open the
file.

Thanks for your great help.

"Mike H" wrote:

> Max,
>
> Modify your code like this and note the 2 added lines
>
> Sub StartDemo1()
> On Error Resume Next
> Set OldCell = ActiveCell
> ActiveSheet.Shapes("Picture 1").Select
> For i = 0 To 360 Step 3
> Wait (0.08)
> Selection.ShapeRange.IncrementRotation 15
> Selection.ShapeRange.Left = Selection.ShapeRange.Left + 10
> Selection.ShapeRange.Top = Selection.ShapeRange.Top - 0.1
> DoEvents
> Next i
>
> For i = 360 To 0 Step -6
> Wait (0.08)
> Selection.ShapeRange.IncrementRotation -15
> Selection.ShapeRange.Left = Selection.ShapeRange.Left - 20
> Selection.ShapeRange.Top = Selection.ShapeRange.Top + 0.1
> DoEvents
> Next i
> Selection.ShapeRange.Top = 300
> Selection.ShapeRange.Left = 42
> OldCell.Select
> End Sub
>
> Mike
>
> "MAX" wrote:
>
> > Will you please tell me where I am going to put wait(0.08) because I'm a
> > beginer in VB.
> >
> > "Mike H" wrote:
> >
> > > Max,
> > >
> > > application.wait is a bit of a blunt instrument so try this instead
> > >
> > > Alt+F11 to open VB editor, right click 'ThisWorkbook' and insert module and
> > > paste the code below in. In each of the 2 loops in your code add the line
> > >
> > > wait(0.08)
> > >
> > > the 0.08 gave me a nice smooth scroll but you can play with this.
> > >
> > > Sub Wait(DelaySecs As Single)
> > > Dim sngSec As Single
> > > EndDelay = Timer + DelaySecs
> > > Do While Timer < EndDelay
> > > DoEvents
> > > Loop
> > > End Sub
> > >
> > > Mike
> > >
> > > "MAX" wrote:
> > >
> > > > I have an animated excel file with a picture rolling from left to right of
> > > > the screen. The is done when I click on the picture. My first problem is that
> > > > the picture rolls very fast and I want to reduce its speed, and the second
> > > > problem is that I want this animation not when I click on the picture but
> > > > when I open the file. I am using Excel 2007 and below is the code that I am
> > > > using. Any help.
> > > >
> > > > Thanks.
> > > >
> > > > Code:
> > > >
> > > > Sub StartDemo1()
> > > > On Error Resume Next
> > > > Set OldCell = ActiveCell
> > > > ActiveSheet.Shapes("Picture 1").Select
> > > > For i = 0 To 360 Step 3
> > > > Selection.ShapeRange.IncrementRotation 15
> > > > Selection.ShapeRange.Left = Selection.ShapeRange.Left + 10
> > > > Selection.ShapeRange.Top = Selection.ShapeRange.Top - 0.1
> > > > DoEvents
> > > > Next i
> > > >
> > > > For i = 360 To 0 Step -6
> > > > Selection.ShapeRange.IncrementRotation -15
> > > > Selection.ShapeRange.Left = Selection.ShapeRange.Left - 20
> > > > Selection.ShapeRange.Top = Selection.ShapeRange.Top + 0.1
> > > > DoEvents
> > > > Next i
> > > > Selection.ShapeRange.Top = 300
> > > > Selection.ShapeRange.Left = 42
> > > > OldCell.Select
> > > > End Sub
> > > >

 
Reply With Quote
 
Gary''s Student
Guest
Posts: n/a
 
      29th Mar 2009
To start your demo automatically, put the following event macro in the
workboook code area:

Private Sub Workbook_Open()
Sheets("Sheet1").Activate
Call StartDemo1
End Sub

Adjust the name of the worksheet to match your sheet name.


Because it is workbook code, it is very easy to install and use:

1. right-click the tiny Excel icon just to the left of File on the Menu Bar
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about Event Macros (workbook code), see:

http://www.mvps.org/dmcritchie/excel/event.htm


--
Gary''s Student - gsnu200841


"MAX" wrote:

> Very nice timing, but although I put the the code in the workbook I have
> still to click on the picture for the animation, I want this when I open the
> file.
>
> Thanks for your great help.
>
> "Mike H" wrote:
>
> > Max,
> >
> > Modify your code like this and note the 2 added lines
> >
> > Sub StartDemo1()
> > On Error Resume Next
> > Set OldCell = ActiveCell
> > ActiveSheet.Shapes("Picture 1").Select
> > For i = 0 To 360 Step 3
> > Wait (0.08)
> > Selection.ShapeRange.IncrementRotation 15
> > Selection.ShapeRange.Left = Selection.ShapeRange.Left + 10
> > Selection.ShapeRange.Top = Selection.ShapeRange.Top - 0.1
> > DoEvents
> > Next i
> >
> > For i = 360 To 0 Step -6
> > Wait (0.08)
> > Selection.ShapeRange.IncrementRotation -15
> > Selection.ShapeRange.Left = Selection.ShapeRange.Left - 20
> > Selection.ShapeRange.Top = Selection.ShapeRange.Top + 0.1
> > DoEvents
> > Next i
> > Selection.ShapeRange.Top = 300
> > Selection.ShapeRange.Left = 42
> > OldCell.Select
> > End Sub
> >
> > Mike
> >
> > "MAX" wrote:
> >
> > > Will you please tell me where I am going to put wait(0.08) because I'm a
> > > beginer in VB.
> > >
> > > "Mike H" wrote:
> > >
> > > > Max,
> > > >
> > > > application.wait is a bit of a blunt instrument so try this instead
> > > >
> > > > Alt+F11 to open VB editor, right click 'ThisWorkbook' and insert module and
> > > > paste the code below in. In each of the 2 loops in your code add the line
> > > >
> > > > wait(0.08)
> > > >
> > > > the 0.08 gave me a nice smooth scroll but you can play with this.
> > > >
> > > > Sub Wait(DelaySecs As Single)
> > > > Dim sngSec As Single
> > > > EndDelay = Timer + DelaySecs
> > > > Do While Timer < EndDelay
> > > > DoEvents
> > > > Loop
> > > > End Sub
> > > >
> > > > Mike
> > > >
> > > > "MAX" wrote:
> > > >
> > > > > I have an animated excel file with a picture rolling from left to right of
> > > > > the screen. The is done when I click on the picture. My first problem is that
> > > > > the picture rolls very fast and I want to reduce its speed, and the second
> > > > > problem is that I want this animation not when I click on the picture but
> > > > > when I open the file. I am using Excel 2007 and below is the code that I am
> > > > > using. Any help.
> > > > >
> > > > > Thanks.
> > > > >
> > > > > Code:
> > > > >
> > > > > Sub StartDemo1()
> > > > > On Error Resume Next
> > > > > Set OldCell = ActiveCell
> > > > > ActiveSheet.Shapes("Picture 1").Select
> > > > > For i = 0 To 360 Step 3
> > > > > Selection.ShapeRange.IncrementRotation 15
> > > > > Selection.ShapeRange.Left = Selection.ShapeRange.Left + 10
> > > > > Selection.ShapeRange.Top = Selection.ShapeRange.Top - 0.1
> > > > > DoEvents
> > > > > Next i
> > > > >
> > > > > For i = 360 To 0 Step -6
> > > > > Selection.ShapeRange.IncrementRotation -15
> > > > > Selection.ShapeRange.Left = Selection.ShapeRange.Left - 20
> > > > > Selection.ShapeRange.Top = Selection.ShapeRange.Top + 0.1
> > > > > DoEvents
> > > > > Next i
> > > > > Selection.ShapeRange.Top = 300
> > > > > Selection.ShapeRange.Left = 42
> > > > > OldCell.Select
> > > > > End Sub
> > > > >

 
Reply With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      29th Mar 2009
As mentioned in my earlier post write the code in Workbook_Open()
event

If this post helps click Yes
---------------
Jacob Skaria


"MAX" wrote:

> Very nice timing, but although I put the the code in the workbook I have
> still to click on the picture for the animation, I want this when I open the
> file.
>
> Thanks for your great help.
>
> "Mike H" wrote:
>
> > Max,
> >
> > Modify your code like this and note the 2 added lines
> >
> > Sub StartDemo1()
> > On Error Resume Next
> > Set OldCell = ActiveCell
> > ActiveSheet.Shapes("Picture 1").Select
> > For i = 0 To 360 Step 3
> > Wait (0.08)
> > Selection.ShapeRange.IncrementRotation 15
> > Selection.ShapeRange.Left = Selection.ShapeRange.Left + 10
> > Selection.ShapeRange.Top = Selection.ShapeRange.Top - 0.1
> > DoEvents
> > Next i
> >
> > For i = 360 To 0 Step -6
> > Wait (0.08)
> > Selection.ShapeRange.IncrementRotation -15
> > Selection.ShapeRange.Left = Selection.ShapeRange.Left - 20
> > Selection.ShapeRange.Top = Selection.ShapeRange.Top + 0.1
> > DoEvents
> > Next i
> > Selection.ShapeRange.Top = 300
> > Selection.ShapeRange.Left = 42
> > OldCell.Select
> > End Sub
> >
> > Mike
> >
> > "MAX" wrote:
> >
> > > Will you please tell me where I am going to put wait(0.08) because I'm a
> > > beginer in VB.
> > >
> > > "Mike H" wrote:
> > >
> > > > Max,
> > > >
> > > > application.wait is a bit of a blunt instrument so try this instead
> > > >
> > > > Alt+F11 to open VB editor, right click 'ThisWorkbook' and insert module and
> > > > paste the code below in. In each of the 2 loops in your code add the line
> > > >
> > > > wait(0.08)
> > > >
> > > > the 0.08 gave me a nice smooth scroll but you can play with this.
> > > >
> > > > Sub Wait(DelaySecs As Single)
> > > > Dim sngSec As Single
> > > > EndDelay = Timer + DelaySecs
> > > > Do While Timer < EndDelay
> > > > DoEvents
> > > > Loop
> > > > End Sub
> > > >
> > > > Mike
> > > >
> > > > "MAX" wrote:
> > > >
> > > > > I have an animated excel file with a picture rolling from left to right of
> > > > > the screen. The is done when I click on the picture. My first problem is that
> > > > > the picture rolls very fast and I want to reduce its speed, and the second
> > > > > problem is that I want this animation not when I click on the picture but
> > > > > when I open the file. I am using Excel 2007 and below is the code that I am
> > > > > using. Any help.
> > > > >
> > > > > Thanks.
> > > > >
> > > > > Code:
> > > > >
> > > > > Sub StartDemo1()
> > > > > On Error Resume Next
> > > > > Set OldCell = ActiveCell
> > > > > ActiveSheet.Shapes("Picture 1").Select
> > > > > For i = 0 To 360 Step 3
> > > > > Selection.ShapeRange.IncrementRotation 15
> > > > > Selection.ShapeRange.Left = Selection.ShapeRange.Left + 10
> > > > > Selection.ShapeRange.Top = Selection.ShapeRange.Top - 0.1
> > > > > DoEvents
> > > > > Next i
> > > > >
> > > > > For i = 360 To 0 Step -6
> > > > > Selection.ShapeRange.IncrementRotation -15
> > > > > Selection.ShapeRange.Left = Selection.ShapeRange.Left - 20
> > > > > Selection.ShapeRange.Top = Selection.ShapeRange.Top + 0.1
> > > > > DoEvents
> > > > > Next i
> > > > > Selection.ShapeRange.Top = 300
> > > > > Selection.ShapeRange.Left = 42
> > > > > OldCell.Select
> > > > > End Sub
> > > > >

 
Reply With Quote
 
MAX
Guest
Posts: n/a
 
      29th Mar 2009
I already have this code in the workbook (see below) and what you mean by
(Adjust the name of the worksheet to match your sheet name.)

Sub StartDemo1()
> > > On Error Resume Next
> > > Set OldCell = ActiveCell
> > > ActiveSheet.Shapes("Picture 1").Select
> > > For i = 0 To 360 Step 3
> > > Wait (0.08)
> > > Selection.ShapeRange.IncrementRotation 15
> > > Selection.ShapeRange.Left = Selection.ShapeRange.Left + 10
> > > Selection.ShapeRange.Top = Selection.ShapeRange.Top - 0.1
> > > DoEvents
> > > Next i
> > >
> > > For i = 360 To 0 Step -6
> > > Wait (0.08)
> > > Selection.ShapeRange.IncrementRotation -15
> > > Selection.ShapeRange.Left = Selection.ShapeRange.Left - 20
> > > Selection.ShapeRange.Top = Selection.ShapeRange.Top + 0.1
> > > DoEvents
> > > Next i
> > > Selection.ShapeRange.Top = 300
> > > Selection.ShapeRange.Left = 42
> > > OldCell.Select
> > > End Sub


THANKS.

"Gary''s Student" wrote:

> To start your demo automatically, put the following event macro in the
> workboook code area:
>
> Private Sub Workbook_Open()
> Sheets("Sheet1").Activate
> Call StartDemo1
> End Sub
>
> Adjust the name of the worksheet to match your sheet name.
>
>
> Because it is workbook code, it is very easy to install and use:
>
> 1. right-click the tiny Excel icon just to the left of File on the Menu Bar
> 2. select View Code - this brings up a VBE window
> 3. paste the stuff in and close the VBE window
>
> If you save the workbook, the macro will be saved with it.
>
> To remove the macro:
>
> 1. bring up the VBE windows as above
> 2. clear the code out
> 3. close the VBE window
>
> To learn more about Event Macros (workbook code), see:
>
> http://www.mvps.org/dmcritchie/excel/event.htm
>
>
> --
> Gary''s Student - gsnu200841
>
>
> "MAX" wrote:
>
> > Very nice timing, but although I put the the code in the workbook I have
> > still to click on the picture for the animation, I want this when I open the
> > file.
> >
> > Thanks for your great help.
> >
> > "Mike H" wrote:
> >
> > > Max,
> > >
> > > Modify your code like this and note the 2 added lines
> > >
> > > Sub StartDemo1()
> > > On Error Resume Next
> > > Set OldCell = ActiveCell
> > > ActiveSheet.Shapes("Picture 1").Select
> > > For i = 0 To 360 Step 3
> > > Wait (0.08)
> > > Selection.ShapeRange.IncrementRotation 15
> > > Selection.ShapeRange.Left = Selection.ShapeRange.Left + 10
> > > Selection.ShapeRange.Top = Selection.ShapeRange.Top - 0.1
> > > DoEvents
> > > Next i
> > >
> > > For i = 360 To 0 Step -6
> > > Wait (0.08)
> > > Selection.ShapeRange.IncrementRotation -15
> > > Selection.ShapeRange.Left = Selection.ShapeRange.Left - 20
> > > Selection.ShapeRange.Top = Selection.ShapeRange.Top + 0.1
> > > DoEvents
> > > Next i
> > > Selection.ShapeRange.Top = 300
> > > Selection.ShapeRange.Left = 42
> > > OldCell.Select
> > > End Sub
> > >
> > > Mike
> > >
> > > "MAX" wrote:
> > >
> > > > Will you please tell me where I am going to put wait(0.08) because I'm a
> > > > beginer in VB.
> > > >
> > > > "Mike H" wrote:
> > > >
> > > > > Max,
> > > > >
> > > > > application.wait is a bit of a blunt instrument so try this instead
> > > > >
> > > > > Alt+F11 to open VB editor, right click 'ThisWorkbook' and insert module and
> > > > > paste the code below in. In each of the 2 loops in your code add the line
> > > > >
> > > > > wait(0.08)
> > > > >
> > > > > the 0.08 gave me a nice smooth scroll but you can play with this.
> > > > >
> > > > > Sub Wait(DelaySecs As Single)
> > > > > Dim sngSec As Single
> > > > > EndDelay = Timer + DelaySecs
> > > > > Do While Timer < EndDelay
> > > > > DoEvents
> > > > > Loop
> > > > > End Sub
> > > > >
> > > > > Mike
> > > > >
> > > > > "MAX" wrote:
> > > > >
> > > > > > I have an animated excel file with a picture rolling from left to right of
> > > > > > the screen. The is done when I click on the picture. My first problem is that
> > > > > > the picture rolls very fast and I want to reduce its speed, and the second
> > > > > > problem is that I want this animation not when I click on the picture but
> > > > > > when I open the file. I am using Excel 2007 and below is the code that I am
> > > > > > using. Any help.
> > > > > >
> > > > > > Thanks.
> > > > > >
> > > > > > Code:
> > > > > >
> > > > > > Sub StartDemo1()
> > > > > > On Error Resume Next
> > > > > > Set OldCell = ActiveCell
> > > > > > ActiveSheet.Shapes("Picture 1").Select
> > > > > > For i = 0 To 360 Step 3
> > > > > > Selection.ShapeRange.IncrementRotation 15
> > > > > > Selection.ShapeRange.Left = Selection.ShapeRange.Left + 10
> > > > > > Selection.ShapeRange.Top = Selection.ShapeRange.Top - 0.1
> > > > > > DoEvents
> > > > > > Next i
> > > > > >
> > > > > > For i = 360 To 0 Step -6
> > > > > > Selection.ShapeRange.IncrementRotation -15
> > > > > > Selection.ShapeRange.Left = Selection.ShapeRange.Left - 20
> > > > > > Selection.ShapeRange.Top = Selection.ShapeRange.Top + 0.1
> > > > > > DoEvents
> > > > > > Next i
> > > > > > Selection.ShapeRange.Top = 300
> > > > > > Selection.ShapeRange.Left = 42
> > > > > > OldCell.Select
> > > > > > End Sub
> > > > > >

 
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
Superimposing Animation over Animation Andrea Microsoft Powerpoint 3 16th Mar 2007 01:40 AM
convert custom animation to GIF-animation =?Utf-8?B?T2xkX1BlcmZlc3Nvcg==?= Microsoft Powerpoint 2 14th Jan 2007 07:08 PM
Help With PPT 2003 Animation-last animation won't exit. hudgevudge@yahoo.com Microsoft Powerpoint 2 5th Jun 2006 10:13 AM
Custom Animation and Animation Schemes =?Utf-8?B?bWlzY3Jvc29mdHVzZXI=?= Microsoft Powerpoint 2 22nd Dec 2005 03:35 PM
Animation Question - Can the last animation object on a slide ... =?Utf-8?B?SkNsZW1lbnRz?= Microsoft Powerpoint 5 28th Oct 2004 09:06 PM


Features
 

Advertising
 

Newsgroups
 


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