Results 1 to 9 of 9
  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Denmark
    Posts
    347
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Modifying a 'field' (Word) (WinXP/ O2003)

    (Edited by HansV to provide linke to posts - see <!help=19>Help 19<!/help>)

    Hi Hans,

    In your answer <post#=483023>post 483023</post#> to my <post#=483011>post 483011</post#>, you provided a really useful overview of switches and their usage related to linked tables.

    Now this created a new question...

    When I switch to "View filed codes" (ALT+F9), I can see the actual switches that has been inserted.

    Is there a way that I can modify these directly?

    ex. I've inserted a linked table and has now the following field "LINK Excel.Sheet.8 "C:Tables.xls" "Table1!R22C3:R26C7" a f 5 h * MERGEFORMAT"

    - and is left with two remaining problems.

    1. Table is automatically linked, would like to change that to manual (as far as I can tell, this cannot be controlled in the .pasteExcelTable method)
    2. when the table updates black borders are constantly added no matter how many times I've removed then

    ad. 1. Was looking for .linkformat.autoupdate=false but cannot see how to fetch the actual field from the linkformat collection.
    ad. 2. Got a feeling I would need some kind of event handler for an "update" event here ??

    TIA
    Bests,
    RD


    PS: Wish there were a knob on the TV to turn up the intelligence. There's a knob called "brightness," but that doesn't work

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Modifying a 'field' (Word) (WinXP/ O2003)

    Since this is a follow-up question, it would have been better to post it in the thread you mention.

    You can remove the a switch to change the updating from automatic to manual.

    When you specify that the formatting will match that of the document (f 5), the default table autoformat will be applied each time the linked table is updated. Set Standard Table as default to get rid of the borders.

  3. #3
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Denmark
    Posts
    347
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Modifying a 'field' (Word) (WinXP/ O2003)

    Hans,

    OK - was actually considering to post it in the same thread, but found that it was too different to the original question...

    Anyway - how do I "remove" the a switch...?
    "Set standard table as default..." - not quite sure what you mean there...

    So far I've extracted the field no.with a intVariable = fields.count... being performed right after the .PasteExcelTable method
    subsequently using "Activedocument.fields(intVariable).linkformat.aut oupdate=false" and
    an "Activedocument.fields(intVariable).OLEformat.pree rveFormattingOnUpdate=false"

    to get around this, but is there an easier way to do it??
    Bests,
    RD


    PS: Wish there were a knob on the TV to turn up the intelligence. There's a knob called "brightness," but that doesn't work

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Modifying a 'field' (Word) (WinXP/ O2003)

    By "remove a" I meant delete it manually. In code, you'll probably have to use the way you describe, unless you create the field in code (using Fields.Add) without the a switch.

    If the insertion point is in a table, you can select Table | Table AutoFormat... You can select various preset formats for the table. Table Grid is the default AutoFormat when you install Word. This format includes grid lines. If you select Standard Table and click Default..., you will make this borderless style the default.

  5. #5
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Modifying a 'field' (Word) (WinXP/ O2003)

    When the field codes are visible you can edit them directly, either from the user interface or from within VBA.

    StuartR

  6. #6
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Denmark
    Posts
    347
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Modifying a 'field' (Word) (WinXP/ O2003)

    Like a normal text string?
    - so potentially I could do an Instr or other type of string manipulation?
    Bests,
    RD


    PS: Wish there were a knob on the TV to turn up the intelligence. There's a knob called "brightness," but that doesn't work

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Modifying a 'field' (Word) (WinXP/ O2003)

    Yes.

  8. #8
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Modifying a 'field' (Word) (WinXP/ O2003)

    A field code has a property that contains the exact stuff you see when you use Alt+F9. I think it's myField.Code.Text , but try it and see.

  9. #9
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Modifying a 'field' (Word) (WinXP/ O2003)

    You can manipulate a field by using its .Code property
    <code>
    set fldField = Selection.Fields(1) <font color=448800> ' or however you can identify the correct field </font color=448800>
    strTemp = fldField.Code
    <font color=448800> ' manipulate the text string however you want here </font color=448800>
    fldField.Code = strTemp
    set fldField = Nothing
    </code>
    StuartR

Posting Permissions

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