Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Jul 2003
    Thanked 0 Times in 0 Posts

    Problem saving form data (Word 2002)

    I have developed a rather lengthy form (14 pages) in Word 2002 and I am now unable to save out the data so that it can be imported into a spreadsheet. The fields within the form include text fields, drop down lists and check boxes. I have followed the instructions from the Help menu about going to the Tools menu, Options, and then the Save tab and selecting the Save data only for forms check box. However when I go to save nothing happens.

    When I create a smaller test form, I am able to save out the data as a comma-deliminated text file. Is there a size limitation for using the save data for forms function?

    Does anyone have suggestions for troubleshooting forms?

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Silicon Valley, USA
    Thanked 94 Times in 90 Posts

    Re: Problem saving form data (Word 2002)

    <P ID="edit" class=small>(Edited by jscher2000 on 07-Jul-03 22:07. I made the most relevant part red. The fields I wanted to export were all in the second column of a table. The .StatusText contained the description of the data item.)</P>I haven't heard of this problem, but then again, I don't use Word forms very much. You could override the Save or SaveAs commands with your own code to save the data into any format you like. This is a bit time-consuming when you have a lot of fields. I can give you an example of some code I have used to slap the data into an e-mail message, if you're inclined to use a VBA solution:

    <img src=/w3timages/blueline.gif width=33% height=2><img src=/w3timages/blueline.gif width=33% height=2><img src=/w3timages/blueline.gif width=33% height=2>
    Subject: Re: Emailing ActiveDocument Via Macro (Word 2000) [#162170]
    Poster: jscher2000
    Posted on: 25-Jul-02 03:43
    Here is something I wrote this afternoon and am still working on. It sweeps through a 2-column table which has labels (e.g., Payee: ) in the first column and FormFields in the second column. (The .StatusText of each control is a unique label.)

    This code creates an RTF message. I think this is a limitation of Outlook, that writing to the .Body creates RTF unless you write to the .HTMLBody, but I haven't dug into that yet. If RTF is not useful to you, you might have to do HTML, perhaps faking plain text with PRE tags.

    <pre>Sub MakeMessage()
    'Generate new message to Accounts Payable
    Dim olApp As Outlook.Application, olNS As Outlook.NameSpace
    Dim olNewMsg As Outlook.MailItem
    'Set object reference to Outlook 2000 and, if nec. start it/logon
    On Error Resume Next
    Set olApp = GetObject(, "Outlook.Application")
    If Err.Number = 429 Then 'Outlook was not open...
    On Error GoTo 0
    Set olApp = CreateObject("Outlook.Application")
    Set olNS = olApp.GetNamespace("MAPI")
    On Error GoTo 0
    Set olNS = olApp.GetNamespace("MAPI")
    End If
    'Create and populate new message
    Set olNewMsg = olApp.CreateItem(olMailItem)
    With olNewMsg
    Dim recip As Recipient
    Set recip = .Recipients.Add("")
    recip.Type = olTo
    Set recip = .Recipients.Add("")
    recip.Type = olCC
    .Subject = "Check Req/Needed:" & ActiveDocument.FormFields("ReqdDate").Result
    .Body = "Hello, Accounts Payable. This Check Request is being submitted by " & _
    "email only. Thanks for your help!" & vbCrLf & vbCrLf
    Dim intRows As Integer, intRowCounter As Integer
    Dim tbl As Table, strText As String, frmFld As FormField
    Set tbl = ActiveDocument.Tables(1)
    intRows = tbl.Rows.Count
    For intRowCounter = 2 To intRows
    If tbl.Cell(intRowCounter, 2).Range.FormFields.Count = 0 Then
    'this is meant to be copied over as text, but can't from protected doc
    .Body = .Body & "<Row " & intRowCounter & " blank>" & vbCrLf
    'tack on the non-empty form field values, separated by VbCrLf
    <font color=red>For Each frmFld In tbl.Cell(intRowCounter, 2).Range.FormFields
    If Len(frmFld.Result) > 0 Then
    .Body = .Body & frmFld.StatusText & " " & frmFld.Result & vbCrLf
    End If
    Next</font color=red>
    End If
    End With
    If Not frmFld Is Nothing
    Then Set frmFld = Nothing
    If Not tbl Is Nothing
    Then Set tbl = Nothing
    If Not recip Is Nothing Then
    Set recip = Nothing
    If Not olNewMsg Is Nothing Then
    Set olNewMsg = Nothing
    If Not olNS Is Nothing Then
    Set olNS = Nothing
    If Not olApp Is Nothing Then
    Set olApp = Nothing
    End Sub</pre>

    A long time ago I tried to manipulate the "envelope" that opens when you choose File|Send to|Mail Recipient but I could never crack how to do it. If it could be done, I believe it would be more mail client-independent.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts