Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am able to reproducibly crash Excel v. X running on a Mac (OS 10.1.5).
Can someone reproduce this behavior, and, if so, any ideas as to how to avoid the problem? To demonstrate, copy the code into Excel, enter, say, "asdfEasdf" in a cell, and select the cell. Then run the FormatAnything procedure. As is, the code won't cause a crash. It will replace the third character with "X". Now uncomment the line that superscripts a character, and run the code again. On my machine, Excel quits with a message saying that the system and other applications were not damaged by the failure. Sub FormatAnything() ' Various objects can be sent from here to "DoFormat", which ' formats the user's selection. DoFormat Selection.Cells(1, 1) ' The "Cells" part is needed to handle merged cells. End Sub Sub DoFormat(rTextObject As Object) ' Uncomment the following line to crash Word V. X SR1 on OS 10.1.5 'rTextObject.Characters(6, 1).Font.Superscript = True rTextObject.Characters(3, 1).Insert ("X") End Sub One interpretation is that "Insert" causes the program to lose track of where previously applied formatting was applied, resulting in the crash. Chris King |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
By the way, I've never had any problem on a PC with this code. The code
also worked on a Mac using Office 98, and Office 2001. I've not tried it with Office 2004. Chris "Christopher King" wrote in message ... I am able to reproducibly crash Excel v. X running on a Mac (OS 10.1.5). Can someone reproduce this behavior, and, if so, any ideas as to how to avoid the problem? To demonstrate, copy the code into Excel, enter, say, "asdfEasdf" in a cell, and select the cell. Then run the FormatAnything procedure. As is, the code won't cause a crash. It will replace the third character with "X". Now uncomment the line that superscripts a character, and run the code again. On my machine, Excel quits with a message saying that the system and other applications were not damaged by the failure. Sub FormatAnything() ' Various objects can be sent from here to "DoFormat", which ' formats the user's selection. DoFormat Selection.Cells(1, 1) ' The "Cells" part is needed to handle merged cells. End Sub Sub DoFormat(rTextObject As Object) ' Uncomment the following line to crash Word V. X SR1 on OS 10.1.5 'rTextObject.Characters(6, 1).Font.Superscript = True rTextObject.Characters(3, 1).Insert ("X") End Sub One interpretation is that "Insert" causes the program to lose track of where previously applied formatting was applied, resulting in the crash. Chris King |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Insert Leading Characters If String Is Only 7 Characters | Excel Discussion (Misc queries) | |||
How to insert special characters in a cell | Excel Discussion (Misc queries) | |||
How do I insert spaces between characters | Excel Discussion (Misc queries) | |||
Insert photo in Excel 2007 causes crash | Excel Discussion (Misc queries) | |||
Excel & Access (Office XP) crash | Excel Discussion (Misc queries) |