PDA

View Full Version : Word Basic to VBA



Bryan32
12-07-2008, 04:07 PM
Hello,

I am new to the forum and relatively new VBA. I have an issue. I have an old wordbasic program that is a letter writing program. It calls letter control files up which in turn tells word which letter to run as well as paragraph control files that place the specific wording into the letter.

I need to add so letters to the program however I don't want to go into notepad and write out wordbasic in a letter control file and paragraph control file. I was wondering if there was any ideas to use VBA to write the new letter that are required to intertwine with the current program?

I am using word 2000 and I was think to save a letter control file with a command to call a specific macro that will extract data from an already formatted word document. Is there a way that I can do this? What needs to happen is the person activates the old program when they select one of the new letters from the userform then it places the header that is already created and selects the letter control file that runs the macro that extracts the pre-formatted paragraph from a word document then goes back to the old program to place the signature in with CC that are being sent with the letter.

Any guidance is very much appreciated.

Thanks everyone,

Bryan

fumei
12-08-2008, 03:28 PM
Without knowing more details of how the "old" program works, it is hard to say anything. However, trying to mix "old" code with "new" code is generally a bad idea.

It would a much better idea to create a new program that does what you want it to do.

If the requirement is a building mechanism - a document is created of identifiable and selected chunks - then this is a fairly common need. It is quite do-able.

"letter control file"???? "paragraph control file"???? I have no idea what you really mean by that, but it does not sounds too good.

Bryan32
12-08-2008, 07:57 PM
The letter control File is like a module that holds the code to create the letter in wordbasic. The module in Word 2000 calls the letter control file which directs which paragraph control files belong in the letter. They are formatted with coding in a notepad and ended with an .LCF and .PCF extension.

But I need to start new because mixing code is not good? Is there conflicts of some sort? The program I would need to write would have to connect to four different databases and I would have to create a program that would be able to create 750 different specific letters.

Is it better to just create the old word basic coding to add me 20 new letters or is it really worth it to write an up to date program? What is the benefits to having VBA coding compared to wordbasic?

How should I start creating such a program?

Thanks for all your help,

Bryan

fumei
12-09-2008, 01:04 PM
Yikes.
I still do not know what you mean by:

"The module in Word 2000 calls the letter control file"

If it is a text file (done in Notepad) what is there to "call"? You may describe it as "like a module that holds the code", but it is NOT a module.

This is quite odd.

In any case, again, I do not have enough details, so it is hard to say. But it IS very common to construct documents via some sort of user interface. Presumably a userform.

The constructed document can be built by a number of methods.

1. using bookmarks (containing text) that are removed by the logic determined by the user choices;

2. using AutoText entries that are inserted by the logic determined by the user choices;

3. using boiler-plate documents from which content can be extracted by the logic determined by the user choices.

Full logic construction can use one method, or a combination of methods.

IMO, VBA is much better than wordbasic. There are better use of resources, and the use of objects is far superior.

But again, I do not have enough details. Are you working from a template (a .DOT) file?

Bryan32
12-09-2008, 07:37 PM
I don't really have a good description of what the letter control file is because I was unaware of this type of extension until a couple of weeks ago. The LCF and PCF hold word basic commands that when called will populate certain text into a letter.

Thanks for the explanation is is very much appreciated. I am very new to programming and getting valuable advise from you guys is great.
:friends: :friends: :friends:

Bryan

fumei
12-10-2008, 09:58 AM
I still do not understand the LCF idea. These seem to be text files. They are not "called". They can be opened and the text brought into the code parser, and then used.

I think. If this is the case (which I think it is), then it would be better to have that code IN a real module.

Bryan32
12-10-2008, 07:13 PM
Called probably is the right verbiage. It references the LCF and when it does it compiles the code in it and creates the letter.

Is there a program that will convert wordbasic to VBA or will I have to change it myself. The thing is I don't now word basic that well so I don't want to lose any functionality when I switch because I don't know everything the code is doing.

Thanks for all of your help!

Bryan

fumei
12-11-2008, 01:14 PM
"It references the LCF and when it does it compiles the code in it"

How does it do that? "References"???? It is a text file. True, it could (again) open the text file, grab the text, bring it into a code module and THEN compile it.

No, there is no converter that makes wordbasic into VBA.