|
[x]
Posted via EE Mobile
|
|
| Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
|
|
|
|
Asked by ChrisHalesTrust in Microsoft Word, Microsoft Office Suite
In the last few days, Word 2007 has begun completely crashing when using the Shapes(1).Delete method in the header foooter ranges. We have used this for years without issues. It continues to work in Word 2003. We believe this may be update related.
It does not matter wether the object is directly or as part of a collection, it still fails.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
|
Public Sub Shape_delete1()
'This is a code segment that consistently crashes word 2007... For the
'last several years this code has run without incident
'
'Environments tested
'1. Windows 7 on a Shuttle SD39P2 configured with 4 Gbytes of RAM
' The Shuttle was recently upgraded from Vista
'2. Office 2007 (32 bit) installed on Server 2008 (32 bit)
'3. Office 2007 (32 bit) installed on a Server 2008 (64 bit) via a HyperV virtual machine using Windows 7 (64 bit)
'4. Office 2007 in Windows XP virtual machine
'5. Office 2007 in Vista
'Action that causes the crash
'1. A jpg image is pasted in the Header as a Floating shape
'2. The image is manually given the Shape Name of bactype1
'3. A code segment such as the one below is run to obtain the
' the Shape
'4. If the Shape.Delete command is run Office 2007 crashes
'
'When did this start
'1. I have used this method Shape deletion for 9 years
' without incident
'2. This behaviour is very recent... I can't be sure whether it
' started before the upgrade from Vista to Windows 7 or after
' the upgrade. It appears to have started in the last 5 days.
'
Dim shps As Shapes
Dim shp As Shape
'
On Error GoTo finis
Set shps = ActiveDocument.Sections(1).Headers(wdHeaderFooterFirstPage).Shapes
'
'*************************************************************************
'Breakpoint test.. used to ensure that we are actually picking up the shape
'bactype1 in the collection...
Set shp = shps.Item("bactype1")
'This always returned a valid shape,
'
shp.Delete 'This statement now consistenly crashes word 2007
'
'*************************************************************************
'
'
'This approach to image deletion also crashes Word 2007
For Each shp In shps
If shp.Name = "bactype1" Then
shp.Delete 'bactype1
End If
Next shp
'
Exit Sub
'
finis:
MsgBox ("Shape Delete Error")
'
End Sub
|
20091118-EE-VQP-93 - Hierarchy / EE_QW_3_20080625