LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Crash on Mac with Office v. X: characters.insert

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






 
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
Insert Leading Characters If String Is Only 7 Characters Paperback Writer Excel Discussion (Misc queries) 2 April 21st 09 09:07 PM
How to insert special characters in a cell Uma Nandan Excel Discussion (Misc queries) 7 September 26th 08 08:55 PM
How do I insert spaces between characters mayoyo Excel Discussion (Misc queries) 1 October 3rd 07 11:46 AM
Insert photo in Excel 2007 causes crash DorothyFan1 Excel Discussion (Misc queries) 1 August 17th 07 07:48 AM
Excel & Access (Office XP) crash malcolm Excel Discussion (Misc queries) 0 February 7th 07 02:09 PM


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