Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 390
Default Start when open file

All I want is that is that when I open the file, the animation starts. I have
these codes:
This code is in the Workbook:
Private Sub Workbook_Open()
Sheets("Sheet1").Activate
Call StartDemo1
End Sub
Sub StartDemo1()
On Error Resume Next
Set OldCell = ActiveCell
ActiveSheet.Shapes("Picture 1").Select
For i = 0 To 360 Step 5
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 -10.5
Wait (0.1)
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

and I have this code in the Workbook Module:

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

Why I have to run from Macro to start the animation?

Just to tell you that the name of Sheet 1 is Demo1.

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Start when open file

Is your code in 'ThisWorkbook'? See this for info.:
http://www.ozgrid.com/VBA/auto-run-macros.htm

HTH,
Ryan---


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"MAX" wrote:

All I want is that is that when I open the file, the animation starts. I have
these codes:
This code is in the Workbook:
Private Sub Workbook_Open()
Sheets("Sheet1").Activate
Call StartDemo1
End Sub
Sub StartDemo1()
On Error Resume Next
Set OldCell = ActiveCell
ActiveSheet.Shapes("Picture 1").Select
For i = 0 To 360 Step 5
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 -10.5
Wait (0.1)
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

and I have this code in the Workbook Module:

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

Why I have to run from Macro to start the animation?

Just to tell you that the name of Sheet 1 is Demo1.

Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Start when open file

If the code really is in the ThisWorkbook module, there are two other reasons
why this may not work:

1) The macros are not enabled when you open the workbook
2) Events are not enabled when you open your workbook.

Check those out and let us know what you find.

HTH,
Barb Reinhardt

"MAX" wrote:

All I want is that is that when I open the file, the animation starts. I have
these codes:
This code is in the Workbook:
Private Sub Workbook_Open()
Sheets("Sheet1").Activate
Call StartDemo1
End Sub
Sub StartDemo1()
On Error Resume Next
Set OldCell = ActiveCell
ActiveSheet.Shapes("Picture 1").Select
For i = 0 To 360 Step 5
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 -10.5
Wait (0.1)
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

and I have this code in the Workbook Module:

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

Why I have to run from Macro to start the animation?

Just to tell you that the name of Sheet 1 is Demo1.

Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 390
Default Start when open file

When I open the file, it is giving me this:
Run-time error '9':
Subscript out of range.

"Barb Reinhardt" wrote:

If the code really is in the ThisWorkbook module, there are two other reasons
why this may not work:

1) The macros are not enabled when you open the workbook
2) Events are not enabled when you open your workbook.

Check those out and let us know what you find.

HTH,
Barb Reinhardt

"MAX" wrote:

All I want is that is that when I open the file, the animation starts. I have
these codes:
This code is in the Workbook:
Private Sub Workbook_Open()
Sheets("Sheet1").Activate
Call StartDemo1
End Sub
Sub StartDemo1()
On Error Resume Next
Set OldCell = ActiveCell
ActiveSheet.Shapes("Picture 1").Select
For i = 0 To 360 Step 5
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 -10.5
Wait (0.1)
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

and I have this code in the Workbook Module:

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

Why I have to run from Macro to start the animation?

Just to tell you that the name of Sheet 1 is Demo1.

Thanks.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Start when open file

Modify:
Sheets("Sheet1").Activate
replace "Sheet1"
with the name of the tab containing the picture.
--
Gary''s Student - gsnu200842


"MAX" wrote:

When I open the file, it is giving me this:
Run-time error '9':
Subscript out of range.

"Barb Reinhardt" wrote:

If the code really is in the ThisWorkbook module, there are two other reasons
why this may not work:

1) The macros are not enabled when you open the workbook
2) Events are not enabled when you open your workbook.

Check those out and let us know what you find.

HTH,
Barb Reinhardt

"MAX" wrote:

All I want is that is that when I open the file, the animation starts. I have
these codes:
This code is in the Workbook:
Private Sub Workbook_Open()
Sheets("Sheet1").Activate
Call StartDemo1
End Sub
Sub StartDemo1()
On Error Resume Next
Set OldCell = ActiveCell
ActiveSheet.Shapes("Picture 1").Select
For i = 0 To 360 Step 5
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 -10.5
Wait (0.1)
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

and I have this code in the Workbook Module:

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

Why I have to run from Macro to start the animation?

Just to tell you that the name of Sheet 1 is Demo1.

Thanks.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Start when open file

It has something to do with your sheet name:
http://www.mrexcel.com/archive/Errors/21047.html

Or, there is no data on the sheet...

Good luck,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Gary''s Student" wrote:

Modify:
Sheets("Sheet1").Activate
replace "Sheet1"
with the name of the tab containing the picture.
--
Gary''s Student - gsnu200842


"MAX" wrote:

When I open the file, it is giving me this:
Run-time error '9':
Subscript out of range.

"Barb Reinhardt" wrote:

If the code really is in the ThisWorkbook module, there are two other reasons
why this may not work:

1) The macros are not enabled when you open the workbook
2) Events are not enabled when you open your workbook.

Check those out and let us know what you find.

HTH,
Barb Reinhardt

"MAX" wrote:

All I want is that is that when I open the file, the animation starts. I have
these codes:
This code is in the Workbook:
Private Sub Workbook_Open()
Sheets("Sheet1").Activate
Call StartDemo1
End Sub
Sub StartDemo1()
On Error Resume Next
Set OldCell = ActiveCell
ActiveSheet.Shapes("Picture 1").Select
For i = 0 To 360 Step 5
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 -10.5
Wait (0.1)
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

and I have this code in the Workbook Module:

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

Why I have to run from Macro to start the animation?

Just to tell you that the name of Sheet 1 is Demo1.

Thanks.

  #7   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 390
Default Start when open file

Thank you very much, you solved my problem.

"Gary''s Student" wrote:
at
Modify:
Sheets("Sheet1").Activate
replace "Sheet1"
with the name of the tab containing the picture.
--
Gary''s Student - gsnu200842


"MAX" wrote:

When I open the file, it is giving me this:
Run-time error '9':
Subscript out of range.

"Barb Reinhardt" wrote:

If the code really is in the ThisWorkbook module, there are two other reasons
why this may not work:

1) The macros are not enabled when you open the workbook
2) Events are not enabled when you open your workbook.

Check those out and let us know what you find.

HTH,
Barb Reinhardt

"MAX" wrote:

All I want is that is that when I open the file, the animation starts. I have
these codes:
This code is in the Workbook:
Private Sub Workbook_Open()
Sheets("Sheet1").Activate
Call StartDemo1
End Sub
Sub StartDemo1()
On Error Resume Next
Set OldCell = ActiveCell
ActiveSheet.Shapes("Picture 1").Select
For i = 0 To 360 Step 5
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 -10.5
Wait (0.1)
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

and I have this code in the Workbook Module:

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

Why I have to run from Macro to start the animation?

Just to tell you that the name of Sheet 1 is Demo1.

Thanks.

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
Deleted file tries to open when I start Excel Prospector Excel Discussion (Misc queries) 3 September 17th 09 04:31 PM
How do I prevent Excel trying to open a non-existing file at start Jesperfect Excel Discussion (Misc queries) 0 May 15th 09 01:11 PM
Open File on PC Start Up (Office 2007) Great Simms Excel Discussion (Misc queries) 1 February 9th 08 04:45 PM
How do I start a new application when I open a file? jkwillis99 Excel Discussion (Misc queries) 1 January 13th 06 01:16 PM
start Macro when file is open Martin French Excel Programming 0 February 18th 05 10:17 PM


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

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

About Us

"It's about Microsoft Excel"