Word X "unexpectedly quits" while running a macro

T

tjolson

I'm having a problem withina Word macro while trying to open an Excel
workbook. Oh yeah, and this is running on OS X 10.4 with Word X and
Excel X.

Here is the code, which I "borrowed":

Public Sub GetExcelData()

Dim oXlApp As Excel.Application
Dim oXlBook As Excel.Workbook
Dim oXlSheet As Excel.Worksheet
Dim oXLRange As Excel.Range
Dim bXlStarted As Boolean
Dim sExcelText As String
Dim sFileName As String

On Error Resume Next
'Grab running Excel instance
Set oXlApp = GetObject(, "Excel.Application")
If Err <> 0 Then
'Excel wasn't running
'start it from code
Set oXlApp = CreateObject("Excel.Application")
bXlStarted = True
End If
On Error GoTo 0

sFileName = _
"/Users/Admin/Desktop/Comment Sheet Work
Vol2/Comment-7th-sem3-2005.xls"
MsgBox "File name is " & sFileName
'Get the workbook
Set oXlBook = oXlApp.Workbooks.Open(FileName:=sFileName)

As I step through the code, after the last "Set" statement above to
open the Workbook, Word dies with the message "The application Word
quit unexpectedly." There is a report option, which when I click the
button displays lots of dump info such as:



Date/Time: 2005-09-14 20:59:13.273 -0400
OS Version: 10.4.2 (Build 8C46)
Report Version: 3

Command: Microsoft Word
Path: /Applications/Microsoft Office X/Microsoft Word
Parent: WindowServer [63]

Version: 10.1.6 (10.1.6 (040913), © 1983-2001 Microsoft Corporation.
All rights reserved.)

PID: 7329
Thread: 0

Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000000

Thread 0 Crashed:
0 oaremZ 0x07312c88 0x72ffb00 + 78216
1 oaremZ 0x07314584 0x72ffb00 + 84612
2 <<00000000>> 0x07da77f4 0 + 131758068
3 <<00000000>> 0x07da77f4 0 + 131758068
4 VBE 0x075567a8 0x73b5000 + 1709992
5 VBE 0x07543724 0x73b5000 + 1632036
6 <<00000000>> 0x05c88c94 0 + 97029268
7 <<00000000>> 0x07da5d60 0 + 131751264
8 VBE 0x075567a8 0x73b5000 + 1709992
9 VBE 0x07543724 0x73b5000 + 1632036
10 VBE 0x07543574 0x73b5000 + 1631604
11 VBE 0x075ddff0 0x73b5000 + 2265072
12 VBE 0x075ddeb4 0x73b5000 + 2264756
13 VBE 0x074f41f8 0x73b5000 + 1307128
14 VBE 0x074d48f0 0x73b5000 + 1177840
15 VBE 0x074b56d8 0x73b5000 + 1050328
16 VBE 0x07414f00 0x73b5000 + 392960
17 VBE 0x074763d4 0x73b5000 + 791508
18 Microsoft_Office_2001Z 0x0105364c 0x1008000 + 308812
19 Microsoft_Office_2001Z 0x01053438 0x1008000 + 308280
20 Microsoft_Office_2001Z 0x0105334c 0x1008000 + 308044
21 Microsoft_Office_2001Z 0x01051d9c 0x1008000 + 302492
22 MCPZ.stb 0x005d84a8 0x5c59d0 + 76504
23 MCPZ.stb 0x005d83ac 0x5c59d0 + 76252
24 com.apple.HIToolbox 0x931288d4
DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*,
HandlerCallRec*) + 692
25 com.apple.HIToolbox 0x9312802c
SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*,
HandlerCallRec*) + 372
26 com.apple.HIToolbox 0x93127ea8
SendEventToEventTargetWithOptions + 40
27 com.apple.HIToolbox 0x9312f1ec
ToolboxEventDispatcherHandler(OpaqueEventHandlerCallRef*,
OpaqueEventRef*, void*) + 704
28 com.apple.HIToolbox 0x93128b24
DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*,
HandlerCallRec*) + 1284
29 com.apple.HIToolbox 0x9312802c
SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*,
HandlerCallRec*) + 372
30 com.apple.HIToolbox 0x9312edb0
SendEventToEventTarget +
40
31 MCPZ.stb 0x005fb530 0x5c59d0 + 220000
32 Microsoft Word 0x020da0d0 0x2008000 + 860368
33 Microsoft Word 0x0201d1e0 0x2008000 + 86496
34 Microsoft_Office_2001Z 0x01021964 0x1008000 + 104804
35 Microsoft Word 0x0201cc28 0x2008000 + 85032

and much more....

So what next? I'm not sure what would be the best approach. It seems
like a defect, code trying to go someplace it should not, but what
code? Word? Excel? VBA? and how do I report it to Microsoft? Could it
be somthing else?
Any suggestions about this problem would be appreciated.

Thanks,
Tom
 
D

Doug Robbins

There are a couple of Word Mac MVP's, but they are rarely seen here. I
would suggest that you post to the microsoft.public/mac/office/word
newsgroup

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
I'm having a problem withina Word macro while trying to open an Excel
workbook. Oh yeah, and this is running on OS X 10.4 with Word X and
Excel X.

Here is the code, which I "borrowed":

Public Sub GetExcelData()

Dim oXlApp As Excel.Application
Dim oXlBook As Excel.Workbook
Dim oXlSheet As Excel.Worksheet
Dim oXLRange As Excel.Range
Dim bXlStarted As Boolean
Dim sExcelText As String
Dim sFileName As String

On Error Resume Next
'Grab running Excel instance
Set oXlApp = GetObject(, "Excel.Application")
If Err <> 0 Then
'Excel wasn't running
'start it from code
Set oXlApp = CreateObject("Excel.Application")
bXlStarted = True
End If
On Error GoTo 0

sFileName = _
"/Users/Admin/Desktop/Comment Sheet Work
Vol2/Comment-7th-sem3-2005.xls"
MsgBox "File name is " & sFileName
'Get the workbook
Set oXlBook = oXlApp.Workbooks.Open(FileName:=sFileName)

As I step through the code, after the last "Set" statement above to
open the Workbook, Word dies with the message "The application Word
quit unexpectedly." There is a report option, which when I click the
button displays lots of dump info such as:



Date/Time: 2005-09-14 20:59:13.273 -0400
OS Version: 10.4.2 (Build 8C46)
Report Version: 3

Command: Microsoft Word
Path: /Applications/Microsoft Office X/Microsoft Word
Parent: WindowServer [63]

Version: 10.1.6 (10.1.6 (040913), © 1983-2001 Microsoft Corporation.
All rights reserved.)

PID: 7329
Thread: 0

Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000000

Thread 0 Crashed:
0 oaremZ 0x07312c88 0x72ffb00 + 78216
1 oaremZ 0x07314584 0x72ffb00 + 84612
2 <<00000000>> 0x07da77f4 0 + 131758068
3 <<00000000>> 0x07da77f4 0 + 131758068
4 VBE 0x075567a8 0x73b5000 + 1709992
5 VBE 0x07543724 0x73b5000 + 1632036
6 <<00000000>> 0x05c88c94 0 + 97029268
7 <<00000000>> 0x07da5d60 0 + 131751264
8 VBE 0x075567a8 0x73b5000 + 1709992
9 VBE 0x07543724 0x73b5000 + 1632036
10 VBE 0x07543574 0x73b5000 + 1631604
11 VBE 0x075ddff0 0x73b5000 + 2265072
12 VBE 0x075ddeb4 0x73b5000 + 2264756
13 VBE 0x074f41f8 0x73b5000 + 1307128
14 VBE 0x074d48f0 0x73b5000 + 1177840
15 VBE 0x074b56d8 0x73b5000 + 1050328
16 VBE 0x07414f00 0x73b5000 + 392960
17 VBE 0x074763d4 0x73b5000 + 791508
18 Microsoft_Office_2001Z 0x0105364c 0x1008000 + 308812
19 Microsoft_Office_2001Z 0x01053438 0x1008000 + 308280
20 Microsoft_Office_2001Z 0x0105334c 0x1008000 + 308044
21 Microsoft_Office_2001Z 0x01051d9c 0x1008000 + 302492
22 MCPZ.stb 0x005d84a8 0x5c59d0 + 76504
23 MCPZ.stb 0x005d83ac 0x5c59d0 + 76252
24 com.apple.HIToolbox 0x931288d4
DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*,
HandlerCallRec*) + 692
25 com.apple.HIToolbox 0x9312802c
SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*,
HandlerCallRec*) + 372
26 com.apple.HIToolbox 0x93127ea8
SendEventToEventTargetWithOptions + 40
27 com.apple.HIToolbox 0x9312f1ec
ToolboxEventDispatcherHandler(OpaqueEventHandlerCallRef*,
OpaqueEventRef*, void*) + 704
28 com.apple.HIToolbox 0x93128b24
DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*,
HandlerCallRec*) + 1284
29 com.apple.HIToolbox 0x9312802c
SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*,
HandlerCallRec*) + 372
30 com.apple.HIToolbox 0x9312edb0
SendEventToEventTarget +
40
31 MCPZ.stb 0x005fb530 0x5c59d0 + 220000
32 Microsoft Word 0x020da0d0 0x2008000 + 860368
33 Microsoft Word 0x0201d1e0 0x2008000 + 86496
34 Microsoft_Office_2001Z 0x01021964 0x1008000 + 104804
35 Microsoft Word 0x0201cc28 0x2008000 + 85032

and much more....

So what next? I'm not sure what would be the best approach. It seems
like a defect, code trying to go someplace it should not, but what
code? Word? Excel? VBA? and how do I report it to Microsoft? Could it
be somthing else?
Any suggestions about this problem would be appreciated.

Thanks,
Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top