Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert Word macro to code
Message
 
À
07/10/2008 16:07:47
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01353435
Message ID:
01353438
Vues:
29
>Hello,
>
>I have created a macro in Word I need to work into some existing code. I basically just copied it in and as you can imagine, it found errors everywhere! I'm not surprised, but grateful I can turn to all of you. The following is what was created in Word (and does not give me insight into how to start Word either):
>
>Sub guestlabels()
>'
>' guestlabels Macro
>' Macro recorded 10/7/2008 by Martha Kroll
>'
> ChangeFileOpenDirectory "C:\byteworks\gmr\lunches\"
> Documents.Open FileName:="GUESTLABELS.DOC", ConfirmConversions:=False, _
> ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
> PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
> WritePasswordTemplate:="", Format:=wdOpenFormatAuto
> With ActiveDocument.MailMerge
> .Destination = wdSendToPrinter
> .SuppressBlankLines = True
> With .DataSource
> .FirstRecord = wdDefaultFirstRecord
> .LastRecord = wdDefaultLastRecord
> End With
> .Execute Pause:=False
> End With
>End Sub
>
>My customer is frustrated trying to deal with a mail merge and my intent is to remove their need to be involved in that part of the process.
>
>Any suggestions as to how to work this into my code would be greatly appreciated.
>
>Thanks so much,
>Martha Kroll
#define wdSendToPrinter        1
#define wdDefaultFirstRecord   1
#define wdDefaultLastRecord  -16

LOCAL oWord AS Word.Application

oWord.Documents.Open("C:\byteworks\gmr\lunches\GUESTLABELS.DOC")
With oWord.ActiveDocument.MailMerge
     .Destination        = wdSendToPrinter
     .SuppressBlankLines = .t.
     With .DataSource
          .FirstRecord = wdDefaultFirstRecord
          .LastRecord = wdDefaultLastRecord
      EndWith
     .Execute()
EndWith
not tested!!!!
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform