|
-
Feb 2nd, 2006, 12:05 AM
#1
Thread Starter
Lively Member
[RESOLVED] word to vb
isit possible that we insert ms word to our vb program?
-
Feb 2nd, 2006, 01:06 AM
#2
Re: word to vb
You mean like display a Word document contents in your app or the actual Word application app in your app?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 2nd, 2006, 02:13 AM
#3
Re: word to vb
to just insert the OLE control from the toolbox and select create new and select word document. I hope this is what you want
If an answer to your question has been helpful, then please, Rate it!
Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.
-
Feb 2nd, 2006, 08:43 AM
#4
Thread Starter
Lively Member
Re: word to vb
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?
-
Feb 2nd, 2006, 08:48 AM
#5
Re: word to vb
Do you wish to create a new, blank, Word document, or open and display an existing Word document?
-
Feb 2nd, 2006, 08:49 AM
#6
Thread Starter
Lively Member
Re: word to vb
open and display an existing word document
-
Feb 2nd, 2006, 08:53 AM
#7
Re: word to vb
Set a reference to the Microsoft Word Object Library
Code:
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
-
Feb 2nd, 2006, 09:03 AM
#8
Thread Starter
Lively Member
Re: word to vb
it states user-defined type not defined and points to line
Dim objWord As Word.Application
-
Feb 2nd, 2006, 09:05 AM
#9
Re: word to vb
 Originally Posted by yanty
it states user-defined type not defined and points to line
Dim objWord As Word.Application
This is because you haven't done this
 Originally Posted by Hack
Set a reference to the Microsoft Word Object Library
-
Feb 2nd, 2006, 09:10 AM
#10
Thread Starter
Lively Member
Re: word to vb
Yay! It worked. Yeah.. I forgot the reference. Thank you.
-
Feb 2nd, 2006, 09:52 AM
#11
Re: word to vb
 Originally Posted by yanty
Yay! It worked. Yeah.. I forgot the reference. Thank you. 
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 this
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
Dont forget the reference to the Word Object Library.
-
Feb 2nd, 2006, 10:12 AM
#12
Thread Starter
Lively Member
Re: [RESOLVED] word to vb
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.
-
Feb 2nd, 2006, 10:15 AM
#13
Re: [RESOLVED] word to vb
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|