N
NickP
Hi there,
I have a class that basically enumerates the pages of a Word document
and creates thumbnails from them. It does not always work, and the error
message does not make any sense...
Clip...
ImageStream = CreateObject("ADODB.Stream")
With ImageStream
.Type = 1
.Open()
Dim pObjTemp As Object =
cObjDocument.ActiveWindow.Panes(1).Pages(iIndex).EnhMetaFileBits
.Write(pObjTemp)
.SaveToFile("c:\test.emf")
.Close()
ImageStream = Nothing
End With
Every so often it fails on the 5th line. I recieve the following
error...
http://msdn2.microsoft.com/en-us/library/aa211944(office.11).aspx
Strange thing is, without even changing the code, and a few attempts
later it works! So I added the following 2 lines...
Dim pIntPaneCount As Integer = cObjDocument.ActiveWindow.Panes.Count()
Dim pIntPageCount As Integer =
cObjDocument.ActiveWindow.Panes(1).Pages.Count()
That way the next time the error occured I could check the limits as
according to the error; I am outside of them, which (excuse my French, is
complete bull5h1t).
Crazy thing is, adding these 2 lines temporarily caused it to start
working again! Until now, with these 2 lines in, and my values without a
doubt within the limits, it has stopped working again, and no doubt it will
start again.
I have checked for running instances of Word, which sometimes helps if I
terminate them, especially if they aren't visible. But that doesn't always
help.
Has anyone got any idea what could be happening here?
Nick.
I have a class that basically enumerates the pages of a Word document
and creates thumbnails from them. It does not always work, and the error
message does not make any sense...
Clip...
ImageStream = CreateObject("ADODB.Stream")
With ImageStream
.Type = 1
.Open()
Dim pObjTemp As Object =
cObjDocument.ActiveWindow.Panes(1).Pages(iIndex).EnhMetaFileBits
.Write(pObjTemp)
.SaveToFile("c:\test.emf")
.Close()
ImageStream = Nothing
End With
Every so often it fails on the 5th line. I recieve the following
error...
http://msdn2.microsoft.com/en-us/library/aa211944(office.11).aspx
Strange thing is, without even changing the code, and a few attempts
later it works! So I added the following 2 lines...
Dim pIntPaneCount As Integer = cObjDocument.ActiveWindow.Panes.Count()
Dim pIntPageCount As Integer =
cObjDocument.ActiveWindow.Panes(1).Pages.Count()
That way the next time the error occured I could check the limits as
according to the error; I am outside of them, which (excuse my French, is
complete bull5h1t).
Crazy thing is, adding these 2 lines temporarily caused it to start
working again! Until now, with these 2 lines in, and my values without a
doubt within the limits, it has stopped working again, and no doubt it will
start again.
I have checked for running instances of Word, which sometimes helps if I
terminate them, especially if they aren't visible. But that doesn't always
help.
Has anyone got any idea what could be happening here?
Nick.