Link to home
Start Free TrialLog in
Avatar of jscharpf
jscharpf

asked on

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
Avatar of jscharpf
jscharpf

ASKER

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
Nuther oops..

I DID get word to open with .visible =True

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

Jeff
ASKER CERTIFIED SOLUTION
Avatar of samopal
samopal

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Nuther oops..

I DID get word to open with .visible =True

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

Jeff
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?
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
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
Thanks for the help.
Sorry about the delay