User Profile

Collapse

Profile Sidebar

Collapse
tsnave
tsnave
Last Activity: Aug 21 '13, 04:40 PM
Joined: Jul 29 '13
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Losing Content Controls when .docx is saved as .doc

    I have VBA code for Pulling data from Word Forms for Word 2007 & 2010. However, some people that are going to be using the form have older versions of Word. When they open the .docx form, the content controls disappear. I converted the from to use Legacy Controls. I am having a hard time converting the code to get the data from the Legacy Controls. Is there an easy fix for modifying the code?

    Thanks
    See more | Go to post

  • tsnave
    replied to Changing default text in content control
    I have found a solution to my problem. Here is a sample of the code that replaces the default "Click here to enter text", from a plain text content control, with "n/a" in an Access DB:
    Code:
     Case "Agency Name"
                     If cc.ShowingPlaceholderText = False Then
                     agencyName = cc.Range.Text
                     Else: agencyName = "n/a"
                     End If
    ...
    See more | Go to post

    Leave a comment:


  • tsnave
    replied to Changing default text in content control
    Thank you for your help. I will try to find out where to see if the PlaceholderText Property is set or exists.
    See more | Go to post

    Leave a comment:


  • tsnave
    replied to Changing default text in content control
    The document given to me is a template made by someone else. I'm not sure about the PlaceHolderText Property. The cc is set up in a loop to go through each content control and the controls are plain text:

    Code:
    For Each cc In doc.ContentControls
            ccInfo = "<> ID= " & cc.ID & " Title = " & cc.Title & " Text = " & cc.Range.Text & vbCrLf
            Debug.Print
    ...
    See more | Go to post

    Leave a comment:


  • tsnave
    replied to Changing default text in content control
    Here are the ones it doesn't work with. When I use the cc.PlaceholderT ext, I get an error. The error is 91:Object Variable or With Block not Set.

    Code:
     Case "PS Name of School or Program"
                    If cc.Range.Text <> "Click here to enter text" Then
                    psNameOfSchool = cc.Range.Text
                    Else: psNameOfSchool = "n/a"
                    End If
    ...
    See more | Go to post

    Leave a comment:


  • tsnave
    started a topic Changing default text in content control

    Changing default text in content control

    I am importing data from content controls in Word to Access 2010. When the data is imported, "Click here to enter text" shows up in the DB table. This is when a user leaves that content control empty on the Form. I would like to Have "n/a" show up in the DB table. The code I am using is working for some DB fields but not all. Here is a sample:
    Code:
     Case "CP Goal"
                    If cc.Range.Text <> cc.PlaceholderText
    ...
    See more | Go to post

  • I got the checkboxes figured out and here is the finished working code:

    Code:
    Sub GetWordData()
    
    Dim cc As ContentControl
    Dim fc As Field
    Dim ccInfo As String
    Dim YourName As String
    Dim YourAddress As String
    Dim YourPhone As String
    Dim Male As String
    Dim Female As String
    Dim appWord As Word.Application
    Dim doc As Word.Document
    Dim cnn As New ADODB.Connection
    ...
    See more | Go to post
    Last edited by zmbd; Jul 31 '13, 10:01 PM. Reason: [Z{Please Use the [Code/] formating button}]

    Leave a comment:


  • Here is my modified code. Works great. I do have 2 checkboxes that I need if they are checked or not.

    Code:
    Sub GetWordData()
    
    Dim cc As ContentControl
    Dim fc As Field
    Dim ccInfo As String
    Dim YourName As String
    Dim YourAddress As String
    Dim YourPhone As String
    Dim Male As CheckBox
    Dim Female As CheckBox
    Dim appWord As Word.Application
    Dim doc As Word.Document
    ...
    See more | Go to post
    Last edited by zmbd; Jul 31 '13, 10:00 PM. Reason: [Z{Please Use the [Code/] formating button}]

    Leave a comment:


  • Thank you for all your help. I am going to have to refer to the title of the content control. This project was given to me by a professor who already has 370+ documents already filled out with this type of controls and need the data imported into Access.
    See more | Go to post

    Leave a comment:


  • >>>Cut and paste - Start<<<
    Start of controls, Count = 5

    <> ID= 261426431 Title = YourName Tag = YourName Text = Todd Snavely

    <> ID= 846142673 Title = YourAddress Tag = YourAddress Text = 1234 Main St.

    <> ID= 2918279744 Title = YourPhone Tag = YourPhone Text = 555-5555

    <> ID= 1014266676 Title = Male Tag = Male Text = ?

    <> ID= 3052641625...
    See more | Go to post

    Leave a comment:


  • That did pull the data from the form. Thank you very much. Now, I just got to put that into Access
    See more | Go to post

    Leave a comment:


  • I am getting the same error and I am using Access and Word 2010. Also the "classic" field controls.
    See more | Go to post

    Leave a comment:


  • I commented out line 12 and the error occurs at:
    rst.Fields("Ful lName") = doc.FormFields( "YourName").Res ult

    I took out the txt in front of YourName so it would match the content control exactly.

    Should I change FormFields to ContentControl?
    See more | Go to post

    Leave a comment:


  • When I get to the line:
    rst.Fields("Ful lName")=doc.For mFields("txtYou rName").Result
    it sends me to the error handling:
    Case -21447022986, 429 section. I kept scrolling through and got error 5941: The requested member of the collection does not exist.

    Thank you for your response
    See more | Go to post

    Leave a comment:


  • Importing data from Word form content control into Access

    I am trying to take the user input from a Word form and place it into an Access DB. I have the document and database in the same folder on my C drive. I am getting an error at :

    rst.Fields("Ful lName") = doc.FormFields( "txtYourName"). Result

    It is not getting the data from the content control.

    Here is all of the of the code:

    Code:
    Sub GetWordData()
    
    
    Dim
    ...
    See more | Go to post
No activity results to display
Show More
Working...