Page 1 of 2 12 LastLast
Results 1 to 15 of 28
  1. #1
    Star Lounger
    Join Date
    Aug 2015
    Posts
    98
    Thanks
    14
    Thanked 0 Times in 0 Posts

    VBA code for converting all non-field square brackets to form field square brackets Word 2010

    Currently when updating documents I have to convert non-fielded square brackets quite a long winded way - insert and open a text form field into doc, insert left square bracket (repeat for right square bracket), highlight left fielded square bracket Ctrl H to insert into find then in replace insert ^c, replace all (repeat for right square bracket). This is really time consuming but I don't know how to write a VBA code for it - could anyone help me please
    Thanks
    Shelley

  2. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Perhaps you could explain why you're using these brackets & formfields at all. Better still, explain what you're trying to achieve with this process. I can't make sense of what you're doing. Simply adding [ & ] to a document doesn't create formfields.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  3. #3
    Star Lounger
    Join Date
    Aug 2015
    Posts
    98
    Thanks
    14
    Thanked 0 Times in 0 Posts
    Hi Paul, in UK legal precedent documents, square brackets are used where there might be more than one option to choose from (especially property documents such as lease, agreement for lease etc.) depending client requirements for a particular transaction, what might be ok for one client may not be the same requirement for another client, e.g. [The Seller][The Buyer] or [he][she] or [6][12] months etc. so these types of optional phrases are put within (currently manual) square brackets so the fee earner can accept/change/delete to suit each client (fee earners send through pdfs of the doc with their scribbled handwriting/crossing out to the document production unit). Our house style has recently changed in that all manual square brackets must be converted to fields so the dpu operator can then just F11 through the doc to locate each square bracket and amend accordingly to save time. We have 1000s of documents to update so was looking for a quick fix to this problem.

  4. #4
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,191
    Thanks
    48
    Thanked 985 Times in 915 Posts
    Maybe macropod could be a fee earner for that one?

    cheers, Paul

  5. #5
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Levin, Manawatu-Wanganui, New Zealand
    Posts
    324
    Thanks
    9
    Thanked 28 Times in 26 Posts
    Hi
    (fee earners send through pdfs of the doc with their scribbled handwriting/crossing out to the document production unit)
    Wow, omg.
    Thousands of docs <> quick

    He / she/ his / hers, their, their's, our. That must be a long list of optional terms.

    Pay macropod.

  6. #6
    Star Lounger
    Join Date
    Aug 2015
    Posts
    98
    Thanks
    14
    Thanked 0 Times in 0 Posts
    I am just a mere dpu operator - I have asked out IT dept to help but was told 'we do not support word development', yes I was baffled by that one to - would happily pay anyone willing to make my work life easier shame my company can't say the same, that's solicitors for you. Thanks for the responses though. Regards Shelley

  7. #7
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    OK, but though you're calling these fields formfields, there's no indication they're anything other than ordinary fields (e.g. DATE, PAGE, REF, etc. fields). If you're using documents in which users are meant to input text, choose and option, etc., you should probably be using true formfields in templates with 'filling in forms' protection applied. Simply double-clicking on such a template will create a new document will all the fields in-situ and in which users can move between fields just by pressing the TAB key. Moreover, field coding in such forms can be used to generate dependent text, perform calculations, and so on, thus minimising the risk of error. No [ ] required - unless you really want them. See attached demo.

    If you send such a form out to a client, upon return it's a trivial exercise for the formfields to be locked or replaced with their inputs.
    Attached Files Attached Files
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  8. #8
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Levin, Manawatu-Wanganui, New Zealand
    Posts
    324
    Thanks
    9
    Thanked 28 Times in 26 Posts
    Shelley
    Can you post a silly sample doc ?
    Geof

  9. #9
    Lounger
    Join Date
    Nov 2008
    Location
    Sydney, New South Wales, Australia
    Posts
    33
    Thanks
    0
    Thanked 1 Time in 1 Post
    Hi laughsalot (what else can one do)!

    F11 is out of date you would move to Content Controls but below addin DocuFill from CDEV Computing is excellent and means only the authors (fee earners) need to fill in the information ONCE or you can fill it in from the handwriting on the pdf you receive.

    You can spend $US39 and become the Word Developer by using an addin from CDEV a UK business run by Chris Devrell. His addin Docufill will resolve the fee earner's horror. What version of Word do you use? The fee earners can do the work themselves and you Shelley can just check the document and its formatting etc. Or if they still handwrite edits and pdf them to you, you can fill in the variables using this program - better yet buy your own copy and enjoy laughingalot for pleasure not out of wanting to pull your hair out (ouch)!

    Surely you can give yourself a leg up to Word Developer and get the fee earners to authorise a few copies of the program (remember to laughalot)!

    -----------------------------------------------------------------------
    To Set-up documents/templates:
    Open the document/template that you wish to have DocuFill operate against. Enclose each occurrence of a variable in square brackets Eg: [Client Name].

    You can have variables in the Header and Footer areas of a document.

    It is a good idea to make the variables descriptive so rather than say [date] use [date of appointment]

    This is an example of marked-up text:
    [Client Name] of [Client Address] signed the contract on [signing date].

    And it is required that the user type his/her/their/its etc …. DocuFill has the facility to offer a drop-down list instead of a text box. To set this up, type the variable in the document together with the required list options in the following format (note the colon and commas)

    [pnoun: his, her, their, its].

    This will then appear as follows in the DocuFill dialog

    pnoun: his
    her
    their
    its

    The below image is what the dialog window that pops up to allow you to fill in the variables in square brackets. There is an options setting for dropdown choices and how they are typed in the Word document. Download the trial and open a Word File New document from the template and it will show all text in square brackets. You hit next page to move through to the end of the variables. If the variable is more than once in the template you insert the same variable in all those places and it is filled in.



    Docfill image.png

    Docufill Sample legal document.png

    This is an excellent program Shelley. Chris does bespoke work for many companies including Microsoft so I urge you to give the program a try.

    Regards
    Janine
    Last edited by jec1; 2015-08-09 at 05:54.

  10. #10
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Quote Originally Posted by jec1 View Post
    F11 is out of date you would move to Content Controls
    That's hardly an accurate characterisation of F11, which works in all Word versions for moving between fields.

    As for content controls, they don't work on Macs or with Word versions prior to Word 2007 - and even content control checkboxes don't work with Word 2007. Even if that were not a concern, you can't perform automatic calculations or generate conditional output with content controls unless the document is a macro-enabled one and, since you can't ensure macros would be enabled by the client (especially given the potential for macros to be used to do harm), one can't even ensure such a document would be functional.

    Since the documents are for use by clients who may be using Macs or PCs with Word 2007 & earlier, it's best to stick with features supported by both platforms and all versions. Hence formfields and other fields.

    As for DocuFill, that appears to be a US-centric product, but Shelley is in the UK. And, since the documents need to be sent to clients for them to fill in, I'd question whether DocuFill is applicable for this even in the US.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  11. #11
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    I would recommend investigating Content Controls too. Paul's arguments against CCs are well founded but Shelley's case may still suit Content Controls quite well.

    The 'fee earners' appear to be in-house legal staff so Word 2007+ on Windows machines may not be a issue. Files are sent to clients in PDF form so their versions of Word are irrelevant. If the Word files were converted to doc format or opened by Mac versions of Word, the CCs will gracefully degrade to become fields so the content won't be lost anyway. CCs do have some real advantages which fields don't provide. Date Pickers are very slick for instance. Using CCs you could also create a single 'client xml file' and using a simple macro to embed that file into any of the 1000s of proforma documents to instantly create a customised document where all the relevant 'fields' are completed.

    I haven't used DocuFill but there is no need to use a paid tool when Greg Maxey provides an excellent CC tool for free. See http://gregmaxey.mvps.org/word_tip_p...rol_tools.html
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  12. #12
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Quote Originally Posted by Andrew Lockton View Post
    Files are sent to clients in PDF form so their versions of Word are irrelevant.
    I see nothing in the previous discussion to suggest clients get PDFs. Shelley said only that:
    fee earners send through pdfs of the doc with their scribbled handwriting/crossing out to the document production unit
    The use of formfields would allow the clients to make choices in the form itself, rather than having the fee earners send through hard-copy with "scribbled handwriting/crossing out".
    Quote Originally Posted by Andrew Lockton View Post
    If the Word files were converted to doc format or opened by Mac versions of Word, the CCs will gracefully degrade to become fields so the content won't be lost anyway.
    IIRC, they become plain text, not fields, just like when you convert such a document to the .doc format. Granted, the displayed content isn't lost, but the functionality is, and that's what using formfields without the need for macros is about.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  13. #13
    Lounger
    Join Date
    Nov 2008
    Location
    Sydney, New South Wales, Australia
    Posts
    33
    Thanks
    0
    Thanked 1 Time in 1 Post
    [QUOTE=Andrew Lockton;1015888] Using CCs you could also create a single 'client xml file' and using a simple macro to embed that file into any of the 1000s of proforma documents to instantly create a customised document where all the relevant 'fields' are completed.

    Now I am curious Andrew. Can you provide more information re embedding simple macro with client xml data please Andrew?

    CCs are just as much work as Formfields which would be text1 etc when converted and all duplicate (same data) fields a xref would need to be created and copied - just as much time as mapped CCs would take.

    Regards
    Janine

  14. #14
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    Paul
    Yes, you are right. it looks like Shelley is saying that the fee earners write on paper copies and then scan this as PDFs for back-office staff to implement these changes to existing Word templates. She did not specify how files are sent to clients. However, regardless of how electronic copies are supplied to external clients, if those documents display 'mass production' evidence like fields OR CCs the client is right to feel devalued. Better to remove this type of evidence from electronic outputs if you want to charge top dollar for your documents.

    IMO the use of formfields offers advantages over the use of Content Controls but in many situations, Content Controls are a better solution. Both provide a means of allowing edits that can be replicated through the document.

    Janine
    I prefer to use CCs because:
    - they replicate instantaneously when linked (fields need to be updated),
    - can be linked to embedded xml content (thus allowing easy export/import of customer-specific info)
    - can be used to update common document metadata such as title, subject etc (fields can display document metadata but can't be edited directly)
    - can be nested in other CCs
    - can contain rich text formatted information
    - can provide a date picker etc

    Vba code that might be used to embed xml information into a Word document can be seen in the following links:
    https://msdn.microsoft.com/en-us/library/bb608627.aspx
    https://msdn.microsoft.com/en-us/lib...ffice.12).aspx
    http://gregmaxey.mvps.org/word_tip_p...mXMLParts.html

    You can also embed an existing xml file into a Word document using the Word GUI. An example is shown in the first part of this youtube clip https://www.youtube.com/watch?v=OrriThs7m1s
    When an xml file is loaded as a custompart in the document, CCs can be linked by right clicking on the relevant node in the XML Mapping pane. If the document already contained linked CCs to the same structured xml file then the act of loading the xml file would import the new xml data into the CCs placed in the document.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  15. #15
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Quote Originally Posted by Andrew Lockton View Post
    Better to remove this type of evidence from electronic outputs if you want to charge top dollar for your documents.
    Agreed, which is why is suggested unlinking the fields when they're returned. Presumably you have in mind doing the same thing to the content controls??
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Page 1 of 2 12 LastLast

Posting Permissions

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