Extract Address from existing document

G

GrannyM

I've been trying to update some old WordBasic code (written by someone else)
that no longer works in Word 2003.

We have an label macro for our users that lets the user pick what type of
mailing label they need (USPS, UPS, FedEx, etc.) then asks if they want to
hand input the address, pull an address from our database, or pull the
address from an open document. While the rest of the code has been updated
for some time, this piece worked, so we just left it alone (the "if it's
isn't broke, don't fix it" attitude!)

I've tried several things using the Wordbasic conversion tables in Word, but
haven't had any luck. I'm hoping someone here can help.

The code that DID work at one time is:

Dim dlg3 As Object: Set dlg3 =
WordBasic.DialogRecord.ToolsCreateEnvelope(False)
WordBasic.CurValues.ToolsCreateEnvelope dlg3
LabelAddr$ = dlg3.EnvAddress

Everything I try comes up with a blank address. I've tried the below code
with both showing the dialog box and not showing it, (and I do not want to
show it) and either way, LabelAddr$ always comes up blank, even though when
it does show the box, the address is in the dialog box.

Set myDialog = Dialogs(wdDialogToolsCreateEnvelope)
With myDialog
.extractaddress = True
' .Show
End With
LabelAddr$ = myDialog.EnvAddress

Anyone have any ideas on how to either convert the WordBasic Code above or
how to extract the address from a letter without using the dialog box at all?
 

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