Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default 2003 created Workbook casuses error when macro runs in 2007

I have a EXIT Clip Art image on the sheet that runs a macro to Save and
Close the workbook.
However i recently upgraded to Office 2007, but now allt he macros/forms run
fine, but the below code causes an error with excel when it runs, why and
what is the solution?

Sub Picture1_Click()
Application.DisplayAlerts = False
ActiveWorkbook.Save
ActiveWorkbook.Close
Application.DisplayAlerts = True
End Sub


I also use this code in the WB:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("Navigation").Select
On Error Resume Next
Dim WB As Workbook
For Each WB In Application.Workbooks
Debug.Print WB.Name
If WB.Name < ThisWorkbook.Name Then
If WB.Windows(1).Visible = True Then Exit Sub
End If
Next
Application.Quit
End Sub


Corey....


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default 2003 created Workbook casuses error when macro runs in 2007

I have just noticed, that the code posted works OK when it is run from a
Forms Button on a sheet, but NOT when using a Clip Art picture with the
Macro attahced.
Is there a known issue with Pictures/Clip Art and Macros in 2007?


Corey....
"Corey ...." wrote in message
...
I have a EXIT Clip Art image on the sheet that runs a macro to Save and
Close the workbook.
However i recently upgraded to Office 2007, but now allt he macros/forms
run fine, but the below code causes an error with excel when it runs, why
and what is the solution?

Sub Picture1_Click()
Application.DisplayAlerts = False
ActiveWorkbook.Save
ActiveWorkbook.Close
Application.DisplayAlerts = True
End Sub


I also use this code in the WB:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("Navigation").Select
On Error Resume Next
Dim WB As Workbook
For Each WB In Application.Workbooks
Debug.Print WB.Name
If WB.Name < ThisWorkbook.Name Then
If WB.Windows(1).Visible = True Then Exit Sub
End If
Next
Application.Quit
End Sub


Corey....



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 2003 created Workbook casuses error when macro runs in 2007

Yes this is a bug

See
http://www.rondebruin.nl/shape.htm


Read this part for a workaround
"Code run from a shape can crash Excel 2007"


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Corey ...." wrote in message ...
I have just noticed, that the code posted works OK when it is run from a
Forms Button on a sheet, but NOT when using a Clip Art picture with the
Macro attahced.
Is there a known issue with Pictures/Clip Art and Macros in 2007?


Corey....
"Corey ...." wrote in message
...
I have a EXIT Clip Art image on the sheet that runs a macro to Save and
Close the workbook.
However i recently upgraded to Office 2007, but now allt he macros/forms
run fine, but the below code causes an error with excel when it runs, why
and what is the solution?

Sub Picture1_Click()
Application.DisplayAlerts = False
ActiveWorkbook.Save
ActiveWorkbook.Close
Application.DisplayAlerts = True
End Sub


I also use this code in the WB:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("Navigation").Select
On Error Resume Next
Dim WB As Workbook
For Each WB In Application.Workbooks
Debug.Print WB.Name
If WB.Name < ThisWorkbook.Name Then
If WB.Windows(1).Visible = True Then Exit Sub
End If
Next
Application.Quit
End Sub


Corey....



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
running a Macro in 2007 which was created in 2003 Simon Excel Discussion (Misc queries) 8 April 23rd 10 05:31 AM
copy 2007 created macro to run in 2003 amaries Excel Discussion (Misc queries) 4 December 18th 08 07:48 PM
How do I convert a macro that was created in 2003 Excel to 2007 Elizabeth Excel Programming 8 October 22nd 08 01:29 AM
Open Workbook created in Excel 2003 in a computer that runs Excel Artur Excel Discussion (Misc queries) 0 November 22nd 06 02:01 AM
Runtime error for macro that works in workbook created in Crystal Excel Discussion (Misc queries) 1 June 22nd 05 08:43 PM


All times are GMT +1. The time now is 06:02 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"