Word automation or use Rich Text Box on form ...

  • Thread starter Danny J. Lesandrini
  • Start date
D

Danny J. Lesandrini

The requirements for this task are still vague, but it's like

* Create Public Function to return user input of memo text
* Function uses automation to open word
* Allow user to type whatever they wish
* Wait until they finish
* Before close of Word document, grab text for use
* Do not save Word doc, it's just a scratch pad.

Ok, this sounds really stupid as I type it, but let's assume
the reason they want to use Word is that they need to allow
for Rich Text.

Is there any way to do this? To pause processing in a function
while a user types in word and then capture the text when they
close the document?

Alternatively, we could create a Word-like interface using
the RichTextBox control, but does anyone have some nice
formatting code to allow users to Underline, Bold and Color
the font? (I did this years ago with VB but never tried it in
Access and my VB app is long forgotten and gone.)

Thanks
 
D

Dirk Goldgar

Danny J. Lesandrini said:
The requirements for this task are still vague, but it's like

* Create Public Function to return user input of memo text
* Function uses automation to open word
* Allow user to type whatever they wish
* Wait until they finish
* Before close of Word document, grab text for use
* Do not save Word doc, it's just a scratch pad.

Ok, this sounds really stupid as I type it, but let's assume
the reason they want to use Word is that they need to allow
for Rich Text.

Is there any way to do this? To pause processing in a function
while a user types in word and then capture the text when they
close the document?

Alternatively, we could create a Word-like interface using
the RichTextBox control, but does anyone have some nice
formatting code to allow users to Underline, Bold and Color
the font? (I did this years ago with VB but never tried it in
Access and my VB app is long forgotten and gone.)

Danny, have you seen Stephen Lebans' RTF2 control?

http://www.lebans.com/richtext.htm
 
D

Danny J. Lesandrini

Dirk:

No, I haven't. Thanks. That's part of what I was looking for.

BTW, I have a better understanding of what they want to do now.
They have code to generate a mail-merge and print the results. The
code asks them if they want to save the text of the document in a
memo field, which is fine so long as the document is merged and
printed without user intervention, a simple mail merge. However, if
the user is allowed to edit the document before printing, then the
Access code can't grab the text ... at least not without making a
number of assumptions:

Where is the file saved
Is the user done editing
Has the user saved his edits

I don't think this is going to fly. Access can't know when a user
has finished editing a document. Also, if the user closes the custom
mail merge wizard in Access before they save the Word doc, it will
grab the last saved version, which may or may not be the final one.

So, the RTF control won't actually help me here.
 
D

Dirk Goldgar

Danny J. Lesandrini said:
BTW, I have a better understanding of what they want to do now.
They have code to generate a mail-merge and print the results. The
code asks them if they want to save the text of the document in a
memo field, which is fine so long as the document is merged and
printed without user intervention, a simple mail merge. However, if
the user is allowed to edit the document before printing, then the
Access code can't grab the text ... at least not without making a
number of assumptions:

Where is the file saved
Is the user done editing
Has the user saved his edits

I don't think this is going to fly. Access can't know when a user
has finished editing a document. Also, if the user closes the custom
mail merge wizard in Access before they save the Word doc, it will
grab the last saved version, which may or may not be the final one.

So, the RTF control won't actually help me here.

Hmm. Access could run a timer loop, testing in each iteration to see if
the document is locked by Word. Of course, that presupposes (a) you
initially know where the document is stored, and (b) the user doesn't
save the edited document someplace else.

Or you could open a dialog form, on which the user must click a button
to indicate that they're done editing the Word document and have saved
any changes. You might need to add a file-browse option to locate the
edited, saved file, if the user moved it, and a check box to indicate
whether the file should be deleted after its contents have been
imported.

It would be nice if you could establish a callback function in Word, so
as to trap the event of the document's closing. I don't know enough
about Word automation to know if that's possible, but I'm inclined to
doubt it.
 
D

Danny J. Lesandrini

Dirk:

Yes, exactly! Callback is what I'm looking for, but I'm not sure if
that is available either. I'll search the newsgroups for that. Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top