|
-
September 7th, 2004, 10:33 AM
#1
Opening Word Documents
In my program, I am wanting to open a word document and place the cursor at a predefined bookmark inside of the word document. In code, how would I open the document and go to the bookmark? Thanks a lot.
-
September 7th, 2004, 06:11 PM
#2
Re: Opening Word Documents
Opening Word Documents:
Add reference through the COM reference to Microsoft Word 9.0 COM reference library(or whatever is the latest)
'Create a variable that represents the Application class
Dim myWordApp As New Word.Application
'Then assuming you already have a saved doc file in your folder Your word file.doc
doc1=myWordApp.Documents.Open("Your word file.doc")
Now microsoft word provides numerous objects that you can use to program any action that can be done by the word menu command.
I do not know how to go to a bookmark by using word with .Net. However, if I am stuck, I would have done this:
*Record a macro and see what VB code is getting registered for going to a bookmark by the menu
*Try to simulate that code in vb.Net
-
September 8th, 2004, 10:11 AM
#3
Re: Opening Word Documents
-
March 11th, 2005, 11:35 AM
#4
Re: Opening Word Documents
Can AnyOne Tell me how to fill a Microsoft Word textBox from VB.Net ??
I found I can Create One Like This. But I Can't seem to fill it with text . .
Dim oWord As New Word.Application
Dim oDoc As Word._Document
oWord.Visible = True
oDoc = oWord.Documents.Open( _
FileName:="C:\ascentia\docjobsum1.doc", _
ConfirmConversions:=False, _
ReadOnly:=True, _
AddToRecentFiles:=False, _
Format:=Word.WdOpenFormat.wdOpenFormatAuto)
With oDoc.Shapes
.AddTextbox (Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationHorizontal, 10, 10, 100, 10)
End With
-
March 12th, 2005, 02:13 PM
#5
Re: Opening Word Documents
the answer turned out to be
oDoc.Shapes.Item("Text Box 1").Select()
oWord.Selection.TypeText(Text:="Some text")
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
|