type mismatch error in word automation

K

Keith

This code was working fine until today for some reason. I'm having to change
my enumerations to numbers for reasons explained here:
http://support.microsoft.com/kb/112676.

But that's not the issue below (just wanted you to know why I'm doign that).
So I'm suddenly getting "type mismatch" errors on for example the 3rd line
below. The "CarrierName" field has a text value in it for example of
"Argonaut" so it has a valid text value. The position in the Word dot file
that is being used for the automation is just a cell in a table (not a
bookmark with any "type" set). This seems pretty random. Some of the
"TypeText" lines work and others don't. Like I said, before I changed my
code due to suggestions in the link above, the "TypeText" code worked fine.
Any ideas?


objWord.Selection.TypeText "Workers' Compensation"
objWord.Selection.MoveRight Unit:=12 'wdCell
objWord.Selection.TypeText rsCarriersInfo!CarrierName
objWord.Selection.MoveRight Unit:=12 'wdCell
objWord.Selection.TypeText
Nz(rsCarriersInfo!CarrierStatus, "")
objWord.Selection.MoveRight Unit:=12 'wdCell
objWord.Selection.TypeText
Nz(rsCarriersInfo!CarrierBestsRating, "")
objWord.Selection.MoveRight Unit:=12 'wdCell
objWord.Selection.TypeText
Nz(rsCarriersInfo!CarrierFinStrength, "")


THanks,

Keith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top