Working with "Default text" in a Word doc. Form Text field



Hello. We’re trying to create a VB application (using .NET 2003) that opens
a formatted Word document, places values from a SQL Server database into Form
fields in the doc (Text fields and Checkbox fields), and then allows the user
to update them. Upon saving, we intend to save the data back in the SQL
Server database.

For the step of placing initial default values into the Form fields, I’ve no
problem doing it for the Checkbox fields with these statements:

oDoc.FormFields.Item("CheckMale").CheckBox.Default = True
oDoc.FormFields.Item("CheckFemale").CheckBox.Default = False

[Note: oDoc = oWord.Documents.Open("C:\test.doc") ]

My question is: I can’t figure out how to set the “Default text” of the Text
Form fields. From an example we found we see how to set a value in the Text
field, such as:

oDoc.FormFields.Item("TextPhone").Range.Text = "555-555-5555"

However we noticed that upon doing so, the Bookmark known as "TextPhone"
disappears as an object, and you can no longer work with it in the VB code.
Therefore we want to set the “Default text” equal to some value.

When you double-click on the Text Form field in unprotected mode you can see
in the “Text Form Field Options” dialog that “Default text” is there, along
with Entry macro, Exit macro, Help text, etc. Looking around the Object
browser, I can see how I could set those other fields (which I don’t care
about), like:

oDoc.FormFields.Item("TextPhone").EntryMacro = "xxx"
oDoc.FormFields.Item("TextPhone").ExitMacro = "xxx"
oDoc.FormFields.Item("TextPhone").HelpText = "xxx"

But where’s “Default text”? The success of this design hinges on this, and
I can’t believe it simply can’t be done.


We’d appreciate any insight anyone has. Thanks.

.



Relevant Pages

  • Working with "Default text" in a Word doc. Form Text field
    ... places values from a SQL Server database into Form ... fields in the doc (Text fields and Checkbox fields), ... with Entry macro, Exit macro, Help text, etc. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Project 2002 to 2003 Error
    ... Project 2003 client on this single SQL Server database for MS Project data. ... We also use a single resource pool that is linked to ... It is my understanding that Project 2003 upgrades any project that has ...
    (microsoft.public.project)
  • Re: jtds driver and SQL Server performance problem
    ... The java application and the SQL Server database both ... > field that is both a unique and a primary key. ...
    (comp.lang.java.databases)
  • Re: Project Server Database Resource Avalaibility
    ... anyone can tell me which is the table where is stored periods ... >> looked both the Sql Server Database and Project's Html Doc about Sql ...
    (microsoft.public.project.pro_and_server)
  • alter table with vb.net
    ... I want to alter the column property of a table I copied from another SQL ... Server database into my SQL Server database. ... colum was an identity colum, ...
    (microsoft.public.dotnet.framework.adonet)