Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
String Too Long to Fit
Message
De
13/05/2000 14:20:50
 
 
À
13/05/2000 10:45:55
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00369164
Message ID:
00369364
Vues:
21
Hi Cetin

Thanks for your help again.

My data SELECTS OK, it's selected prior to creating the Word object. Just FYI I have several programs similar to this for different clients and several for this client; they have all been working. I just started have problems with this one. But I would be anxious to adopt a better method.

The ".Range.Find.Execute("<<"DATE">>",,,,,,,,,NewText,wdReplaceAll)"
statement looks like it would be the answer to my problem. Probably execute faster than my old macro too. I would really appreciate it if you could help me get this to work.

I've attempted to research that statement in my "Word 97 Macro and VBA" book and my "Using Visual FoxPro 6" book and can't find it. When using it in the following routine I get a message that "wdReplaceAll not found". Also how do I replace "TxtToReplace" with the contents of NewText since all but the date or some other variable changes for each letter?

Below is a snippet of the routine where I would use the Range.Find.Execute......
statement. I've noticed that my code is not accuratly reproduced here:
the data I'm replacing such as DATE and NAME etc. is preceded in the template by "<<" and followed by ">>", without the quotes course. It appears here as "<>". And .Range.Find.Execute("<<"DATE">>" for instance.

Regards,

Paige

**** Snippet ****

oWordDoc = CreateObject("Word.Application")
WITH oWordDoc
.Visible = .T.
*
SCAN WHILE NOT EOF()
DO CASE && 0PL = No Prior Letter, 1PL = 1 Prior Letter, 2PL = 2 Prior Letters
CASE Sel_File.New_LetNo = 0 && No Prior Letters - 0PL
lcDocument=lcTempDir+"BetExp01.doc"
CASE Sel_File.New_LetNo = 1 && 1 Prior Letter - 1PL
lcDocument=lcTempDir+"BetExp02.doc"
CASE Sel_File.New_LetNo > 1 && 2 0r More Prior Letters - 21PL
lcDocument=lcTempDir+"BetExp03.doc"
ENDCASE
*
.Documents.open(lcDocument)
*
NewText = MDY(DATE())
*!* DO WordRepl WITH "", NewText
.Range.Find.Execute("<>",,,,,,,,,"May 13, 2000",wdReplaceAll)
*
DO CASE && Checking for Prefix and Middle Name
CASE ! EMPTY(Ins_Prefix) AND ! EMPTY(Ins_Midd1)
NewText=ALLTRIM(Ins_Prefix)+' '+ALLTRIM(Ins_First1)+' '+ALLTRIM(Ins_Midd1)+' '+ALLTRIM(Ins_Last1)+' '+Ins_Suffix
CASE EMPTY(Ins_Prefix) AND ! EMPTY(Ins_Midd1)
NewText=ALLTRIM(Ins_First1)+' '+ALLTRIM(Ins_Midd1)+' '+ALLTRIM(Ins_Last1)+' '+Ins_Suffix
CASE ! EMPTY(Ins_Prefix) AND EMPTY(Ins_Midd1)
NewText=ALLTRIM(Ins_Prefix)+' '+ALLTRIM(Ins_First1)+' '+ALLTRIM(Ins_Last1)+' '+Ins_Suffix
CASE EMPTY(Ins_Prefix) AND EMPTY(Ins_Midd1)
NewText=ALLTRIM(Ins_First1)+' '+ALLTRIM(Ins_Last1)+' '+Ins_Suffix
ENDCASE
*
*!* DO WordRepl WITH "<>", NewText
.Range.Find.Execute("<>",,,,,,,,,NewText,wdReplaceAll)

Replace address etc.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform