Solved

Creating Macros for Microsoft Word

Posted on 2011-03-08
6
261 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The Selection object is designed for user interaction. It has a Range property, so it can be used in most places that a Range object can. Recorded macros must use the Selection because they are simply copying what the user is doing. A Range prope…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

911 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

25 Experts available now in Live!

Get 1:1 Help Now