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
Thanks!
Jeff
ASKER
Nuther oops..
I DID get word to open with .visible =True
So once it's open, uh.. now what lol?
Jeff
I DID get word to open with .visible =True
So once it's open, uh.. now what lol?
Jeff
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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:\T est.doc")
Set oWord = oAppl.Documents.Open(sFile )
.......
.......
code..
.......
.......
Set oWord = Nothing
Set oAppl = Nothing
End Sub
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:\T
Set oWord = oAppl.Documents.Open(sFile
.......
.......
code..
.......
.......
Set oWord = Nothing
Set oAppl = Nothing
End Sub
ASKER
Nuther oops..
I DID get word to open with .visible =True
So once it's open, uh.. now what lol?
Jeff
I DID get word to open with .visible =True
So once it's open, uh.. now what lol?
Jeff
ASKER
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?
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?
ASKER
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
Jeff
ASKER
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
Jeff
ASKER
Thanks for the help.
Sorry about the delay
Sorry about the delay
ASKER
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