Solved

Creating Macros for Microsoft Word

Posted on 2011-03-08
6
263 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction This tutorial provides instructions on how to properly format your Word document using the inbuilt tools provided. The benefits of using these tools means your documents are more accessible and easily portable to other applications an…
This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.

821 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