Jump to content
Server Maintenance This Week. ×

A small automation for Word


Tissot

This topic is 6357 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello guys.

I'm trying to get FM run a VBS Script that does the following:

1. Open an existing Word Doc

2. Enter the address in a text field

3. Enter the date

4. Enter the Customer number

5. Enter Quote number

6. Save the Doc to the this formula: Quote-Nr. & ", " & Name & ", " & Place & ", " & Get(CurrentDate)& ".doc"

7. Leave the Doc Open and ready for editing

Any Help would greatly be appreciated.

Thanks in advance.

Best regards.

Ron

Edited by Guest
Link to comment
Share on other sites

Hi Ron,

When you talk about inserting data into Word "fields" you're really talking about merging data.

Nothing wrong with that but the data source needs to exist. So either you use an ODBC connection back to FM for that (works, but may be total overkill for what you want) or you need to have FM export a small text file first, then execute a VBscript to tell your word document to merge with that text file. Your VBscript can then save the document and leave it open.

so #3 to 5 are handled by the merging. #1 and 6 are relatively straightforward. How much of this do you already have in your VBscript?

Link to comment
Share on other sites

Hi Wim Decorte,

sounds good, I like the version with a Text file, I even tried to do that but I'm no good at VB. I've got some sort of VBS Script written but not worth looking at.

I would greatly apreciate you’re help.

Regards

Ron

Link to comment
Share on other sites

Hi Ron,

I can't obviously write it for you unless you hire me too ;)

Here's how you can attempt it yourself:

- export the text file from filemaker

- in your word document, put on the VBA recorder and go through the whole merge setup, including the final merge

- this will give you VBA code that pretty much does what needs to be done

- you can then use that VBA code to write similar VBScript code.

- (and remove the VBA code from your word document otherwise you'll keep getting security prompts)

Link to comment
Share on other sites

do a search on your machine for *vba*.chm and you'll find one that describes the full Word object model. It's chock full of code examples.

Note that the examples are for VBA, not VBscript but the main difference is that in VBscript:

- you do not type variables

- you can't use named constants. The numerical equivalent of the named constants are also listed in that help file

Link to comment
Share on other sites

This topic is 6357 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.