D
danforest
I wrote a Microsoft Word automation app in VB, which I am now porting
to VB script. My initial code looked like this, and works fine:
Dim o as Word.Application
Set o = New Word.Application
o.documents.add (....)
with o
.Selection.TypeText "blah"
end with
When I change the declaration to
Dim o as Object
Set o = CreateObject ("Word.Application")
The object appears to be created OK, but I get an error 13 type
mismatch on the line starting with '.Selection.TypeText...'
I've tried declaring 'o' with no type specifier, (as you would see in
VBScript), and get the same results. Also, if I declare 'o' as
'Word.Application', and use CreateObject, that works too, so it seems
to be the initial variable declaration causing the problem. Anyone know
what's wrong here? thanks.
Dan
to VB script. My initial code looked like this, and works fine:
Dim o as Word.Application
Set o = New Word.Application
o.documents.add (....)
with o
.Selection.TypeText "blah"
end with
When I change the declaration to
Dim o as Object
Set o = CreateObject ("Word.Application")
The object appears to be created OK, but I get an error 13 type
mismatch on the line starting with '.Selection.TypeText...'
I've tried declaring 'o' with no type specifier, (as you would see in
VBScript), and get the same results. Also, if I declare 'o' as
'Word.Application', and use CreateObject, that works too, so it seems
to be the initial variable declaration causing the problem. Anyone know
what's wrong here? thanks.
Dan