Consulting

Results 1 to 5 of 5

Thread: Word To Excel help

  1. #1
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location

    Word To Excel help

    I have the script below that has worked good, but now want to add two radio buttons for a yes and no question. Can someone assist please.
    What I want is if

    OPButtonYes = True then just to pull the value of a cell and put it in word something like this.
    [vba]If OPButtonYES.Value = True Then
    .formfields("Loopback_0_IPMa").result = ws.Range("B9").Value[/vba]

    Now if OPButtonNO = True Here is where Im stuck.

    I want it delete a few form fields something like this
    [vba]If OPButtonNO.Value = True Then
    delete .formfields("Ma_line1")
    delete .formfields("Ma_line2")
    delete .formfields("Ma_line3")

    etc.. until .formfields("Ma_line10")
    [/vba]

    Here is a few lines of code that works pulling data from word and put's it in excels form fields.
    [vba]

    With wd
    .formfields("site_id").result = ws.Range("b3").Value
    .formfields("Branch_Name").result = ws.Range("B4").Value
    .formfields("Street").result = ws.Range("B5").Value
    .formfields("City").result = ws.Range("B6").Value
    .formfields("State").result = ws.Range("B7").Value
    .formfields("Zip").result = ws.Range("B8").Value
    [/vba]

    Any help would be great.

    Thanks

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    If you're not using the formfields for input directly into the word document you could use bookmarks instead and just leave them.

    They aren't visible as formfields are.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location
    Im using Text Form Fileds with "Default Text" for each one and each one has a bookmark.

    I have some rows of text that If No is selected I want deleted and everything move up not just blank or empty.

    Can this be done?

  4. #4
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location
    BUMP!

  5. #5
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Maybe?
    formfields("Ma_line1").Delete
    etc

Posting Permissions

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