ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel XP/2003 crash (https://www.excelbanter.com/excel-programming/335719-excel-xp-2003-crash.html)

Paul Leonard

Excel XP/2003 crash
 
The routine below will crash Excel XP at the last open. Same with
xlPasteSpecialOperationMultiply.

Works in Excel 2003, but if you then manually close the test.xls workbook
from the File menu, Excel will crash. Workbooks.Close works, though.

No problems doing any of this in Excel 2000.


Sub test()
Workbooks.Add (xlWorksheet)
ActiveWorkbook.SaveAs Filename:="c:\temp\test.xls"

Cells(3, 1) = 1
For i = 2 To 11
Cells(1, i) = i - 1
Cells(2, i) = "=" & Cells(1, i).Address(ColumnAbsolute:=False)
Cells(3, i) = "=" & Cells(3, i - 1).Address(RowAbsolute:=False,
ColumnAbsolute:=False)
Next

Range("B2:K2").Select
Selection.Copy
Range("B3").Select
Selection.PasteSpecial Paste:=xlPasteFormulas,
Operation:=xlPasteSpecialOperationAdd

Workbooks("test.xls").Close Savechanges:=True
Workbooks.Open "c:\temp\test.xls"

Range("B2:K2").Select
Selection.Copy
Range("B3").Select
Selection.PasteSpecial Paste:=xlPasteFormulas,
Operation:=xlPasteSpecialOperationAdd
Workbooks("test.xls").Close Savechanges:=True

Workbooks.Open "c:\temp\test.xls"
End Sub



This kind of operation is blowing up at one of our client sites after they
upgraded from Excel 2000 to Excel 2003 - is there a fix or workaround for
this?

Thanks,
ptl


Peter Huang [MSFT]

Excel XP/2003 crash
 
Hi

Based on my research, I can reproduce your scenario at my side.
So far I have reported the problem to the dev team.
Also if you just want to create a new workbook with special content, why
not use the code similar with below?

If I have any misunderstanding, can you describe more detailed about what
you are going to do?

Sub test()
Workbooks.Add (xlWorksheet)

Cells(3, 1) = 1
For i = 2 To 11
Cells(1, i) = i - 1
Cells(2, i) = "=" & Cells(1, i).Address(ColumnAbsolute:=False)
Cells(3, i) = "=" & Cells(3, i - 1).Address(RowAbsolute:=False,
ColumnAbsolute:=False)
Next

Range("B2:K2").Select
Selection.Copy
Range("B3").Select
Selection.PasteSpecial Paste:=xlPasteFormulas,
Operation:=xlPasteSpecialOperationAdd
ActiveWorkbook.SaveAs "c:\temp\test.xls"
End Sub

Thanks!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


Paul Leonard

Excel XP/2003 crash
 
Hi, Peter

We're not running this as code in our application - i just wrote it to try
to reproduce what our client is seeing when they do something like this
interactively in Excel 2003.

A closer representation of what they're actually doing would be to open
Excel 2003, add a module to a new workbook and run the sub below to set up
some sample formulas that are similar to those in their template. Then
remove the module and save and close the file.

Sub test()
Cells(3, 1) = 1
For i = 2 To 11
Cells(1, i) = i - 1
Cells(2, i) = "=" & Cells(1, i).Address(ColumnAbsolute:=False)
Cells(3, i) = "=" & Cells(3, i - 1).Address(RowAbsolute:=False,
ColumnAbsolute:=False)
Next
End Sub

Now using this file as a starting point, open it, select the B2:K2 range of
cells, then Paste Special with Formulas+Add to the B3 cell. Now Save As to a
different file and close. Open the file you just saved, then close it again
- Excel crashes.


(FYI - never got the notification for your second post, even though i
clicked that threadnotify link in the first notification)


Thanks for your time!

ptl




""Peter Huang" [MSFT]" wrote:

Hi

Based on my research, I can reproduce your scenario at my side.
So far I have reported the problem to the dev team.
Also if you just want to create a new workbook with special content, why
not use the code similar with below?

If I have any misunderstanding, can you describe more detailed about what
you are going to do?

Sub test()
Workbooks.Add (xlWorksheet)

Cells(3, 1) = 1
For i = 2 To 11
Cells(1, i) = i - 1
Cells(2, i) = "=" & Cells(1, i).Address(ColumnAbsolute:=False)
Cells(3, i) = "=" & Cells(3, i - 1).Address(RowAbsolute:=False,
ColumnAbsolute:=False)
Next

Range("B2:K2").Select
Selection.Copy
Range("B3").Select
Selection.PasteSpecial Paste:=xlPasteFormulas,
Operation:=xlPasteSpecialOperationAdd
ActiveWorkbook.SaveAs "c:\temp\test.xls"
End Sub

Thanks!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.



Peter Huang [MSFT]

Excel XP/2003 crash
 
Hi

Thanks for your update, I will report the information to our product group.
Also for the issue about not get notification, I think you may try to send
mail to the email below, so that the related person will help you with that.


Also I you are urgent with the issue, I suggest you contact MSPSS directly.
http://support.microsoft.com

Thanks!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com