Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open an instance of Word within app

Status
Not open for further replies.

BiggerBrother

Technical User
Sep 9, 2003
702
GB
I need to be able to open an instance of word within a form of my app. This way, all the print and close controls remain within my app. It also means that when the user moves from page to page, i can fill in bookmarks for them. I know how to open word as an external source through shell, but wondered if it was possible to embed it, as you can with excel web components?

Probably a very easy question, but not something I have come across before.

Thanks

BB
 
Have you looked at the Ole container? Do you want something other than that? [spin]

If you choose to battle wits with the witless be prepared to lose.

[cheers]
 
I have never used this. I should probably know what it is, but how do i load a .doc into it?

Thanks

BB
 
The best suggestion I can give you is to drop the control on a form and follow the wizard. It will allow you to select a new document or an exsisting one. Play around with it and see if it is what you are looking to do or not. There are other ways, but give the Ole container a try first. Good Luck.

If you choose to battle wits with the witless be prepared to lose.

[cheers]
 
BiggerBrother


does this help.

Btw you have to have a file saved by word called "C:\msic.doc" on your drive to make this work.
If you get any lock errors its because theres already an instance of it running (check you task manager). If you dont close the app before reopening it youll error out.

DASHLEY



Public wrdapp As Word.Application
Public wrddoc As Word.Document
Public wrdtbl As Word.Table
Public wrdsel As Word.Selection


Private Sub Command1_Click()
Dim wrdtbl As Table

Set wrdapp = CreateObject("word.application")
Set wrddoc = wrdapp.Documents.Add
Set wrdsel = wrdapp.Selection

wrdapp.Documents.Open ("C:\misc.doc")
wrddoc.ActiveWindow.Visible = True
wrdsel.Text = "My word document "
wrddoc.SaveAs ("c:\misc1.doc")

End Sub
Private Sub Command2_Click()
wrdapp.Quit
Set wrdapp = Nothing
Set wrddoc = Nothing
End Sub


Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
wrdapp.Quit
Set wrdapp = Nothing
Set wrddoc = Nothing

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top