isit possible that we insert ms word to our vb program?
Printable View
isit possible that we insert ms word to our vb program?
You mean like display a Word document contents in your app or the actual Word application app in your app?
to just insert the OLE control from the toolbox and select create new and select word document. I hope this is what you want
What if I want to make a link on my VB application so that when I click it, Microsoft Word program will open and show my words document. Is that possible?
Do you wish to create a new, blank, Word document, or open and display an existing Word document?
open and display an existing word document
Set a reference to the Microsoft Word Object LibraryCode:Private Sub Command2_Click()
'to open an existing word document
Dim objWord As Word.Application
Set objWord = CreateObject("Word.Application")
objWord.Documents.Open ("c:\worddocs\yanty.doc")
objWord.Visible = True
End Sub
it states user-defined type not defined and points to line
Dim objWord As Word.Application
This is because you haven't done thisQuote:
Originally Posted by yanty
Quote:
Originally Posted by Hack
Yay! It worked. Yeah.. I forgot the reference. Thank you. :wave:
You are welcome. In the event you (or someone else reading this) may some day have a need to open a new, blank, Word document, I'll post thisQuote:
Originally Posted by yanty
Dont forget the reference to the Word Object Library. :)Code:Private Sub Command1_Click()
'to open a new, blank, word document
Dim objWord As Word.Application
Set objWord = New Word.Application
objWord.Visible = True
objWord.Documents.Add
End Sub
But if I were to move my VB application to another folder, I would have to change the location of the file. How can I make my file stick to my VB application. Meaning i dun have to change from c:\desktop\form1.doc to i:\form1.doc everytime i run the program.
i tried to type objWord.Documents.Open ("\form1.doc") only but error occurs cos I need to specify the exact location the file is in.
Use App.Path