Opening word, inserting some text and a graph from VB

Ok, someone posted some very useful code for exporting data into an excel spreadsheet from VB. I'd like to do the same thing with Word. I would like to open up word, put some text into a new document,and (if possible) insert a graph from a second party vb graph. If the graph part doesn't work, then is there a way to generate a chart in Word from VB?
Thanks!

Jeff
jscharpfAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jscharpfAuthor Commented:
Oh i forgot.
Here is what I have so far and this does not open Word up..

Global NewDoc As Word.Application

Set NewDoc = New Word.Application

NewDoc.Documents.Add

With NewDoc
    With .ActiveDocument


I'm using VB6.0 and word 97 is installed

Thanks

Jeff
0
jscharpfAuthor Commented:
Nuther oops..

I DID get word to open with .visible =True

So once it's open,  uh.. now what lol?

Jeff
0
samopalCommented:
First of all, put

NewDoc.Visible = True

In Word :
Menu > Tools > Macro > Record New Macro
and create your document manually.
After that stop macro recording, open it and copy into your VB programm....

Enjoy!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

RuchiCommented:
To your second comment,

You need to add a reference to the MS Word 8.0 Object Library...

Dim oAppl As Word.Application
Dim oWord As Word.Document

Dim sFile As String

Set oAppl = New Word.Application
'Set oWord = oAppl.Documents.Open("c:\Test.doc")
Set oWord = oAppl.Documents.Open(sFile)
.......
.......
code..
.......
.......

Set oWord = Nothing
Set oAppl = Nothing
End Sub
0
jscharpfAuthor Commented:
Nuther oops..

I DID get word to open with .visible =True

So once it's open,  uh.. now what lol?

Jeff
0
jscharpfAuthor Commented:
Ok, I guess I wasn't very clear.
I'm able to open word and a new document.
Now I've got some variables and strings that I wish to place into the document, along with a graph.
Can this be done?
0
jscharpfAuthor Commented:
Ok, I've been able to insert a graph by using the third partys functions where they allow me to export there object as a metafile to the clipboard. Then in the word programming I do a .paste and it puts the graph into my document. Now, how do I insert tables, text, and move around the document?

Jeff
0
jscharpfAuthor Commented:
Ok, I've been able to insert a graph by using the third partys functions where they allow me to export there object as a metafile to the clipboard. Then in the word programming I do a .paste and it puts the graph into my document. Now, how do I insert tables, text, and move around the document?

Jeff
0
jscharpfAuthor Commented:
Thanks for the help.
Sorry about the delay
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.