Word 2010 - Force Formatting In Specific Parts of Document - vba

I am working with Microsoft Word 2010. I have a document that serves as a template for multiple users for a project I am working on. There are two parts of the document I want to force formatting when a user types:
Enter in an email address - I want the address to not automatically turn to a hyperlink. I want it to not turn to a hyperlink on just this part of the document. The rest of it I want hyperlinks to be enabled.
Enter in a URL without www in front (i.e. google.com), and not have the first letter automatically capitalize. I don't want to turn off capitalizing the first letter of a sentence in the whole document. Just in this part of the document.
Is this something that can be done? I tried messing with Fields but did not have any luck. I am familiar with VBA so if there is a way to do this with code, I am open to that too.

Both features you requires are implemented in Word using AutoCorrect/AutoFormat. They are not controlled by the style mechanism and consequently can't be selectively activated.
The mail address formatting can be controlled by styles, and you could prevent the switch to the Hyperlink style from being visible. You could also consider a macro that selectively changes the styles of the text as required in a post-processing pass through the documents - perhaps the next time the document is opened by a user for review.

Related

Where best to store a version number in Word document?

I have a VSTO Add-In that fills a specific Word template document with data from a third party software. The trick here is that some changes in the script are connected to changes in the document. What I want to do now is to manually store some kind of version number in the document information so I can check in the script if the version of the document fits the version of the script.
I already took a look here but there are too many possibilities and I don't just want to pick any random object. I need to store it somewhere where it doesn't get changed.
Where would you recommend to store such a value?
edit: the version number has to be set manually because not every change of the document affects the script.
You have three options:
Document property - can be displayed in a document by using a DocProperty field but can be viewed and easily changed by the user.
Document variable - an old school method but still valid. Can be displayed in a document by using a DocVariable field but can only be added, or the value changed, by using code.
Custom XML Part - can be displayed in a document by mapping to a content control which can allow the value to be changed by the user. If not mapped can only be changed using code, but not as simply as a document variable.

Using VBA to Create Microsoft Word Document Templates

One of my clients requires my help to create corporate document templates in Microsoft Word - from letter, fax to memo.
Here are some of the requirements:
Fixed sections with no changes to font type, size and color
Fixed sections but the admin is able to edit the content
Placements of Sections (e.g. 3cm margin)
User is able to choose if they want a section displayed
A body text content that will be left blank but users can key in.
A different set of rules/formatting for the continuation pages (page 2>)
Just wanted to tap on the brains of all the VBA experts here and learn what is the best way to approach this. I understand that Word Document allows you to create templates and content locking - is that sufficient? I believe with Macro, the client can have stricter control (creating menus to select the required template, and forms to input the information).
Thanks for all your help in advance.
Cheers,
Alvin

Using docusign to sign a batch of PDFs

We want to do the following:
1) upload 2 to 100 or so PDFs per day
2) have two people digitally sign each individual PDF
2a) The first signature needs to be a "certifying signature" - with certifying rights allowing one additional signature in the pdf
From a simple test of the system, it appears the process is - via the UI:
1) Upload the pdfs via the browser
1a) with the browser UI "place" signatures (Position etc.) in the PDFs (can be 100)
2a) First Person Signs the Batch of PDFs and sends the Batch to a recipient.
2b) The recipient signs and "sends them back"
Manually putting in signature fields in 100 PDF documents per day is quite a Task. Out PDFs can be generated with Signature form fields.
Can the Docusign System find specific form fields and use those for specific users - to fill in a digital signature?
Is this possible/and better done with the API? Is there a example or document that describes this somewhere?
I'm new to this System, so this/these question(s) might be completely naive.
Same underlying document is being sent (eg an order form)
If the pdfs are different versions of the same form or document then you use a template. Eg, if the documents are contracts being sent for approval to different people, then they are all the same underlying "contract document," but with different values for customer, dates, etc.
Easiest is to first "tag" the document using a template via the web interface, then use the same template for the subsequent documents. When you upload a new document, DocuSign will also automatically suggest which of your template matches the new document, saving additional steps.
If you have just a couple of different underlying documents then you'd create a matching set of templates. Since a matching template is suggested when the user uploads a doc, it means that the end users only have to tag ad hoc documents that they are sending or when a document format changes.
Documents that vary
For these cases, using a template with Anchor Text Tabs works well. An Anchor Text Tab tells the tab (eg a "Signature" tab) that, rather than being placed at a specific page and x/y co-ordinates, the tab should instead look for specific text in the document. So you create a template with an Anchor Text Tab that will look for the string "Sign here:" the tab will then place itself nearby (you can give the x and y offsets from the text.)
Anchor Text Tabs can also look for text that is "invisible" on the page (same color as the background). So you can change your docs to include invisible strings which will enable the Anchor Text Tabs to find their correct locations on the pages.
API All of the above can be done via the API. Since templates are often just created when a new document is set up, you may want to create the template using the web UI. Then, using the API, select which specific template should be applied to the doc that you've uploaded with the API.

vb.net word automation - bookmarks

I am preparing to make mechanism to fill out word template. I want to fill out it by data from my program. I heard about word bookmarks that I could create and then from program put the data to it. Unfortunately I heard also that when I want to put same value in different places in word I need to prepare separated new bookmarks for it. For instance I want surname to be in 3 different places in word then i cannot use one bookmark for it. Is it true? If so is there any other way to do it?
Yes, you can fill out bookmarks from your program. Be aware of the two different types of bookmarks which are called open or closed (one is empty, the other contains text and you can replace parts of the text or the whole text).
Yes, you can use a bookmark name only once. But you can manipulate the bookmarks in your program when you use bookmarks like bookmark_1 and bookmark_2, so you can replace the same content on different places. Helpful is the object model (https://msdn.microsoft.com/en-us/library/ff841749%28v=office.14%29.aspx)

Locking text fields in embedded document

I have been tasked with updating a spreadsheet that produces a report by replacing text in a template. Previously, the worksheet referenced an outside/separate file-- my job is to get it working in an embedded document.
I currently have text form fields for every input I want to insert within the embedded document template. As it stands, users can edit the document template however they like, but if they accidentally erase a text form field (again, where text is replaced via the vba macro) then it will break the macro and the spreadsheet will be useless.
My question:
Is there some way to lock or protect text form fields such that the rest of the document is editable? I essentially want to have the inverse of a "text form field only" protection.
Alternatively, is there a better way to approach this project? I'm thinking of leaving the spreadsheet as is, but including a "reset" button bringing the template back to it's original state if anything breaks. If I did this method, this would require there NOT to be an external file. Attempts to do this so far have proven unsuccessful.
My general methodology/algorithm goes as follows:
Open the reference document
Replace all the text form fields via bookmarks with plain text,
making sure to reassign the bookmarks afterward (so as to not lose
them if they run the macro more than once).
Save the embedded document as a .doc with the inputs inserted
Replace all bookmarked inputs with text form fields to return the
template to its original state
Any information would be IMMENSELY appreciated. I am slowly running out of time and am feeling stuck.
Many thanks!
-Sooji