PDA

View Full Version : I need some help with VBA Coding!



urbaxe
10-18-2005, 01:08 AM
Hi!

Is this possible, I?m new to Word-VBA :think:

I need a Word template that can do following:
1. Make an ASCII-file with index based on four fields from the template.
2. Make an ASCII-file with static content.
3. Save Word-file in specific name.
4. At the end, FTP these three files to a host (IBM Content Manager OnDemand)

Could some one make me a code skeleton for a kick-start in Word VBA coding?
Any help will be GREATLY appreciated!

TonyJollans
10-18-2005, 03:57 AM
Hi urbaxe,

Welcome to VBAX!

This doesn't seem particularly related to Word. Can you give some more detail?

Why save something in a Word template if you want it in a different type of file? (I'm not entirely sure what you mean by an ASCII file - plain text?)

A file with static content only needs creating once - why can't you do it manually instead of manually putting the content somewhere else in order to automatically create it?

What Word file do you want to save? I don't see any Word file creation in the steps you mention.

urbaxe
10-18-2005, 04:44 AM
OK, it's hard to express what I want in English but I give it a try.



Our company salesmen have to make a delivery note (this is a Word template) when finishing the invoice.



The invoice is processed by our main frame and archived in our archive system (IBM Content Manager OnDemand). The delivery note doesn't process through the main frame and need to be archived to OnDemand separately as it is written. OnDemand need two ASCII files to know how to store the delivery note. One that contain ex. imvoice_nr, date, department. The other ASCII-file is a load file for a UNIX system.



All three files Word.doc, index.txt and loadfile.txt must be sent over to OnDemand via FTP.

TonyJollans
10-18-2005, 05:51 AM
Hi urbaxe,

I don't think you mean (or I hope you don't mean) a Word template - which is a specific thing, not a document so assuming you mean a document, ...

You want to open a document and extract data from it and create a couple of text files - and then save the document (why - if it's not changed?) and then FTP the lot somewhere.

I don't know about the ftp side but if you can post a sample, or full details of all the files (like how to recognise the invoice number, etc.) the rest shouldn't be too dificult.

urbaxe
10-18-2005, 07:07 AM
Hi again!
Here is the Word Document, not template as I said earlier.
It?s three files that must be sent over to OnDemand.
1. The Wordfile itself as another name.
2. Plain ASCII with static load command
3. Plain ASCII with index data
The index data file should contain values captured from the Word document (1.)
The index file must be built up as follow.
*******
FIELD NAMES BEGIN:
CUSTNO
INVDATE
DELNOTENR
FIELD NAMES END:
<CUSTNO>
<INVDATE>
<DELNOTENR>
*******
The load command (2.) is just one row and is the same from time to time.
Ex. arsload xxx -f yyyy -h zzzz

TonyJollans
10-24-2005, 08:56 AM
Hi urbaxe,

I'm really struggling to understand what you want here.

Your fields, CUSTNO, etc. are REF fields - that is they refer to other fields. Those other fields are not in the posted document so the REF fields show up as Error! Bookmark not defined (or something like that). The REF fields themselves aren't named so I can't directly get at them in code. Can you please try and be a bit more specific with your requirements - I do understand language can be a problem but I just don't know what to do at the moment.

Also what are xxx, yyy, and zzz in the load command?