Solved

Creating Macros for Microsoft Word

Posted on 2011-03-08
6
260 Views
Last Modified: 2012-06-27
I use a program that will let us merge data from the program to a word document.  Then the document is automatically saved in pdf form with in the program.  The problem is that the save form is the information that is on the form before it is brought up and we end up making changes to it.  Problem is then we need to save the letter and then import it, cause again when it auto imports it imports the information before changes.  A work around is to have the document answer a few questions, like a comment, that can be filled in before the document actually opens, thus saving the document automatically with the saved inputted information.  

So my question becomes, (See sample document) how can I with vbscript and word, have it ask for the choices before loading document, then have it filled in on the document.  In sample document I would need to know what needs to be checked and then enter a comment before the document actually loads.  Hope this is understandable.
 CL-NH-LEASE-VIOLATION-NOTICE.doc
0
Comment
Question by:mgmhicks
  • 4
  • 2
6 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 35072381
It is a little difficult to understand the scenario here. I think that we would need more explanation.

Here are a few points:

If the document is already a PDF, you would need to convert it back to a Word document if you want Word to edit it.

The document that you posted is not built for easy data entry. It looks designed for manual entry on to paper.

It would probably be better to use VBA rather than VBScript.

Here is a forms document that can be filled in. It is protected (without a password) to demonstrate its use.
LeaseViolation.doc
0
 

Author Comment

by:mgmhicks
ID: 35072425
ok, so what happens is I put this document into our software package, when it loads it automatically saves it to a database with my software package.  With the document you just sent me it would save a blank document (nothing filled in once it loads.)  But If I can get Word throught ASK Field or something like that, to ask me what needs to be checked before it loads completely, the program will then save the document with answers filled in.  Does that help.  So I know I can build a macro or something that would ask the questions upon load, but how to get answers filled into the form you just filled or similiar is the question.

thanks
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 35072789
Outside You might like to try using Fill-In fields. Place each one where you need the text to appear, and make the prompt appropriate.
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 76

Expert Comment

by:GrahamSkan
ID: 35072871
I don't know where the word 'Outside' came from. Ignore it, please.
0
 

Author Comment

by:mgmhicks
ID: 35072881
Can we write a little vb routine, that will load a window with lets say button control and have the answers there corespond to answers we need on the document.  Fill the answers and comment for that matter, then finish load of document with the answers?

0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 35073160
Yes, but the problem might be in starting it.

Does the document have its own unique template? If so, you could try putting these macros into the template to test the situation. They would have to go in the ThisDocument module of the template.

Also, try putting a Fill-in field on the document's template to see if that works.



Option Explicit

Private Sub Document_New()
    MsgBox "New"
End Sub

Private Sub Document_Open()
    MsgBox "Open"
End Sub

Open in new window

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now