Highlighted
Absent Member.
Absent Member.
872 views

[archive] Passing data from Vision Files to Word Documents

[Migrated content. Thread originally posted on 31 August 2004]

I need to pass data held in 5.0 Vision files to fields (bookmarks) in existing word documents, then print the documents directly from Word. These documents are sales contracts, addendums, notices, etc. I don't want to have to create a merge data file, I would like to go directly to the Word Document. Anyone tried something like this?
0 Likes
5 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Passing data from Vision Files to Word Documents

I am sure this is doable. If not by any other means, so at least by using search and replace. To determine how to do that, start up word, load the document of choice, turn on macro recording do a search and replace, stop recording.
This will provide you with vb script code doing this, then I am sure we can do a joint effort to translate that into ACUCOBOL-GT.

Now, having said that, if you are going to do a large number of reports, I doubt this to be very efficient, and would rather encourage you to use the mailmerge technique.

If however, it is just for single sheets, I think it is wise to do as you want to.

One more issue. Remember that if you are passing data by volume, say a price matrix or some. Consider using a table and pass the data in a safearray, it may imply a significant performance improvement.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Passing data from Vision Files to Word Documents

I have used macros to get the VB code to use when passing data directly to Excel spreadsheets. That works quite well. I'm not exactly sure what you mean by "search & replace". What do I search for??

What I hope to accomplish is for a sales agent to be able to display the client's record on the screen and the print the appropriate sales contract and addendum's using existing forms stored as Word documents.

I had hoped it would work similar to passing data to Excel. There I just select a cell and do a MODIFY Sys-Excel-Worksheet. I just imagined there was some similar Active-X call for Word.

Anyway, what do I search and replace for in the Word document?

Thanks,
ssgmiami
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Passing data from Vision Files to Word Documents

[quote]
What do I search for??
[\quote]

For whatever you would like to replace. For instance if you in your template document had a tag InsertItemsOrderedHere you could search and replace that with the # ordered.

[quote]
What I hope to accomplish is for a sales agent to be able to display the client's record on the screen and the print the appropriate sales contract and addendum's using existing forms stored as Word documents.
[\quote]

Sounds like a great idea. This should be pretty straight forward. Then, given that you have the template document. Start recording macro, and do manually what you would like the program to do (using fake manual data). Stop recording, and then translate the vb scripting to ACUCOBOL-GT.

[quote]
I had hoped it would work similar to passing data to Excel. There I just select a cell and do a MODIFY Sys-Excel-Worksheet. I just imagined there was some similar Active-X call for Word.
[\quote]

Not ActiveX this is COM, but yes, there is a similar method for Word, it depends though, that your template contains one or more tables.
Once again, I suggest you record your manual moves and then translate the resulting vb script. That is the easiest way to accomplish this. If you do that, and provide a fake template in this forum, I am sure we are many that will help you out with the translation.

[quote]
Anyway, what do I search and replace for in the Word document?
[\qoute]

Look at the top.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Passing data from Vision Files to Word Documents

Here are links for two VB examples that should get you going, the second one is more comprehensive than the first:

Example 1

Example 2
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Passing data from Vision Files to Word Documents

Maybe you can look at the program I made to open a word-document and replace merge-fields in word by values from the cobol-application. You can reach it through the next link:
http://www.acucorp.com/support/supported/customer_forum/showthread.php?s=&threadid=366
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.