L
larryaxon
I have an Access report with a BoundObjectFrame that contains an MS word doc
from a table that has a column type of OLE Object.
It works fine until I try to get a Word.Application or Word.Document variable
assigned to it so I can do some simple manipulation (just some token
substitution).
The code looks like this:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim ctlOLE As BoundObjectFrame
Dim myWordDoc As Word.Document
Dim o As Object
Set ctlOLE = WordDoc ' WordDoc is the name of the control
Set o = ctlOLE.Object ' it crashes here
' Set myWordDoc = o.Documents(1) ' or something like this: I just
want to do some Word stuff on the object
End Sub
Event though it looks to me like this conforms to the pattern in the code
samples in MS Access help, when I set anything (including the Object variable)
above, as well as a Variant, or whatever to the ctlOLE.Object, it crashes MS
Access and wants to send a report to Microsoft.
Yes, I have MS word in references.
This is MS Access 2003.
I also tried this with an Unbound frame with the same result.
I assume I must be doing something stupid, but I can't find what it is.
Anyone have experience with this?
Thanks.
from a table that has a column type of OLE Object.
It works fine until I try to get a Word.Application or Word.Document variable
assigned to it so I can do some simple manipulation (just some token
substitution).
The code looks like this:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim ctlOLE As BoundObjectFrame
Dim myWordDoc As Word.Document
Dim o As Object
Set ctlOLE = WordDoc ' WordDoc is the name of the control
Set o = ctlOLE.Object ' it crashes here
' Set myWordDoc = o.Documents(1) ' or something like this: I just
want to do some Word stuff on the object
End Sub
Event though it looks to me like this conforms to the pattern in the code
samples in MS Access help, when I set anything (including the Object variable)
above, as well as a Variant, or whatever to the ctlOLE.Object, it crashes MS
Access and wants to send a report to Microsoft.
Yes, I have MS word in references.
This is MS Access 2003.
I also tried this with an Unbound frame with the same result.
I assume I must be doing something stupid, but I can't find what it is.
Anyone have experience with this?
Thanks.