Adding text in MS Word frm VisualBasic - TechRepublic
General discussion
February 27, 2002 at 03:45 AM
intoxicated_cardinal

Adding text in MS Word frm VisualBasic

by intoxicated_cardinal . Updated 24 years, 1 month ago

hi,
can any one plz tell me how to add text in ms word from vb?? [using same vb macro commands as our word macro produces….]

m trying to add text in a word document from VB, initializing the doc is error free, but when i try to use “b” (selection object) the error appears… below is my code…

——————————————
Dim a As New Word.Document
Dim b As Word.Selection
— or — Set b = Word.Selection

b.TypeText “asdf”
[Error: object variable or with block not set]

a.SaveAs (“c:\2.doc”)
———————————————–

wat to do now??
(this code is of form’s load event)…
the reference of ms word is also added in project references….

This discussion is locked

All Comments