sts023
New member
- Joined
- Nov 30, 2016
- Messages
- 5
- Reaction score
- 0
- Points
- 0
- Age
- 73
- Location
- God's Own County
- Excel Version(s)
- 2010 14.0.7212.5000 (32 bit)
Hi all, and Merry Christmas!
I had a Word 2010 document which used to be able to read Worksheets from an Excel 2010 document.
My PC wandered off to the great scrapyard in the sky, and on buying a new one I had some other priorities (and in any case this was a personal project, so not urgent).
On resurrecting the unfinished project on my new PC, I kept on getting “ Error 438: Object doesn’t support this property or method”.
After some research it looked like a common problem was that either Word, Excel, or the Word document may have become corrupt, so I removed “Microsoft Office Professional Plus 2010” and reinstalled it.
I then wrote the following code based on the excellent offerings from Greg Maxey and installed it in a new Word 2010 document.
I still have the same problem.
Can any kind soul offer any help or advice on how to get Word 2010 to read an Excel spreadsheet without the Error 438?
The failing sample code is below.
Thanks in advance…
I had a Word 2010 document which used to be able to read Worksheets from an Excel 2010 document.
My PC wandered off to the great scrapyard in the sky, and on buying a new one I had some other priorities (and in any case this was a personal project, so not urgent).
On resurrecting the unfinished project on my new PC, I kept on getting “ Error 438: Object doesn’t support this property or method”.
After some research it looked like a common problem was that either Word, Excel, or the Word document may have become corrupt, so I removed “Microsoft Office Professional Plus 2010” and reinstalled it.
I then wrote the following code based on the excellent offerings from Greg Maxey and installed it in a new Word 2010 document.
I still have the same problem.
Can any kind soul offer any help or advice on how to get Word 2010 to read an Excel spreadsheet without the Error 438?
The failing sample code is below.
Thanks in advance…
Code:
Public Sub Maxey()
Dim objXLApp As Object
On Error Resume Next
'*
'** If we already have an instance of
'** Excel open, use it.
'*
Set objXLApp = GetObject(, "Excel.Application") 'Uses an existing instance.
If Err.Numnber <> 0 Then
Call MsgBox("Existing instance fails" & vbCrLf & _
"Error number: " & Err.Number & vbCrLf & _
Err.Description, _
vbInformation, _
"Existing")
'*
'** No exxisting instance of Excel, so
'** create one.
'*
Set objXLApp = CreateObject("Excel.Application") 'Creates instance.
If Err.Numnber <> 0 Then
Call MsgBox("New instance fails" & vbCrLf & _
"Error number: " & Err.Number & vbCrLf & _
Err.Description, _
vbInformation, _
"New")
End If
End If
On Error GoTo 0
End Sub 'Maxey