PDA

View Full Version : Problem with objShape.delete on a specific computer.



adrianrff
11-29-2017, 07:44 AM
Hi, folks.

I have a Word file with a Macro that, among other things, deletes a button on the file and saves it with a different name. This is working fine on my PC (Windows 7) and other PC's (mostly windows XP) in the office, but on one particular PC (Windows XP) the code fails on the
objShape.delete line in this bit of code


If Left(ConsecutivoCorregido, 3) <> "SG-" Then
MsgBox "El formato del consecutivo debe tener la forma SG-056-17 (tres números para identificar el memo)"
Exit Sub
End If
Dim objShape As InlineShape
Dim doc As Document
Set doc = Application.ActiveDocument
For Each objShape In doc.InlineShapes
If objShape.Type = wdInlineShapeOLEControlObject Then
objShape.Delete
End If

The error window says "error 438 in execution time" (not sure if this is the exact message in English, I'm translating from Spanish) and "Object does not admit this property or method".

Any idea why would this fail on this particular PC? The PC where it fails is running Windows XP, but so are other PCS in the office where the code runs fine.

Thanks in advance.

macropod
11-29-2017, 01:40 PM
Have you tried repairing the Office installation on the aberrant PC (via Windows Control Panel > Programs > Programs & Features > Microsoft Office (version) > Change > Repair)?

adrianrff
11-29-2017, 01:51 PM
Have you tried repairing the Office installation on the aberrant PC (via Windows Control Panel > Programs > Programs & Features > Microsoft Office (version) > Change > Repair)?

I have not. I will try that tomorrow morning and get back to you.

Thanks for the suggestion.