Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 24th, 2008, 06:13 PM
Authorized User
 
Join Date: Apr 2008
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

 
Old June 6th, 2008, 01:13 PM
Authorized User
 
Join Date: Apr 2008
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








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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.