Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 24th, 2008, 06:13 PM
Authorized User
 
Join Date: Apr 2008
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Pass textbox string to Word document bookmark

I'm trying to open an existing Word document and update some bookmarks with the text from several textboxes on my form. I found the code below from a google search, but I can't get VWD to accept it. I've added a reference to Word 11.0 in the Solution Explorer and I've added the import statement below, but still nothing. Obviously, I'm missing something yet I can't find anything that clues me to what that something is. The stuff underlined has the blue squiggly line under them and a tooltip that says either "Type 'xxx' is not defined", or "Name 'xxx' is not declared". Does anyone have an idea? This the last hurdle to overcome to get my application working completely. BTW, I'm using VB.

 Imports Microsoft.Office.Interop.Word

        Dim wdApp As New [u]Word.Application</u>
        '-- with the keyword "New" you don't need the next line
        wdApp = CreateObject("Word.Application")
        Dim owdDoc As [u]Word.Document</u>

        [u]wdDoc</u> = wdApp.Documents.Open("(actual path omitted\TSPrint.doc")
        wdApp.visible = True
        With [u]wdDoc</u>.Bookmarks
            .Item("EFF").Range.Text = rdoEFF.SelectedItem.Value
            .Item("ATACHAP").Range.Text = txtChapter.Text
            .Item("ATASECT").Range.Text = txtSection.Text
            .Item("CAS").Range.Text = txtCAS.Text
            .Item("FAULT").Range.Text = txtFault.Text
            .Item("CAUSE").Range.Text = txtCause.Text
            .Item("STEP").Range.Text = txtSteps.Text
        End With
        [u]wdDoc</u> = Nothing
        wdApp = Nothing

  #2 (permalink)  
Old June 6th, 2008, 01:13 PM
Authorized User
 
Join Date: Apr 2008
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I figured it out. A simple change to the imports statement cleared up all the issues:

imports word=microsoft.office.interop.word



 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to pass variables to collection(), document() mphare XSLT 9 July 16th, 2009 10:09 AM
create bookmark inside a document debjanib ASP.NET 1.0 and 1.1 Professional 1 December 2nd, 2006 02:36 AM
Me.Bookmark = Me.RecordsetClone.Bookmark rkellogg Access VBA 5 September 8th, 2006 06:28 AM
Protect a Word document zengfu Pro VB 6 0 March 28th, 2005 08:40 AM
Checkbox on word document kareltje Excel VBA 3 February 17th, 2005 11:17 AM



All times are GMT -4. The time now is 09:25 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.