ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[­ì³Ð] ¦Û°Ê¤Æ¦X¨Ö¦C¦L§Þ³N

[­ì³Ð] ¦Û°Ê¤Æ¦X¨Ö¦C¦L§Þ³N

¥»©«³Ì«á¥Ñ linyancheng ©ó 2020-4-18 10:59 ½s¿è

Word¦X¨ÖExcel¦C¦L¡A¦­´Áª©¥»¬O±Ä¬Û¹ï¸ô®|¡AOffice 2007¥H«á¬O±Äµ´¹ï¸ô®|¡C
¬°ÁקK¦]µ´¹ï¸ô®|¦Ó¥¢¥hExcel¸ê®Æ³sµ²ªº³Â·Ð¡A¥i¦b§¹¦¨½s¿èWord¥D¤å¥ó«á¡A±N¨äÁ٭쬰¼Ð·ÇªºWord¤å¥ó¡AµM«á¦bThisDocument¤¤¥[¤J¥H¤U¥N½X¡G

Private Sub Document_Open()

    On Error Resume Next
   
    With ThisDocument.MailMerge
        .MainDocumentType = wdCatalog '¥D¤å¥ó«¬¦¡³]¬°«¬¿ý(¥Ø¿ý)¡A¤]¥i³]¬°«H«ÊwdEnvelopes¡B«H¥ówdFormLetters©Î¼ÐÅÒwdMailingLabels¡C
        .OpenDataSource Name:=ThisDocument.Path & "\¡³¡³¡³¡³¡³.xls" '¡u¡³¡³¡³¡³¡³.xls¡v§ï¦¨¸ê®Æ¨Ó·½ÀɦW¡C°²³]¨Ó·½Àɦb¦P¤@¸ê®Æ§¨¤¤¡C
        
        '.Destination = wdSendToNewDocument
        '.SuppressBlankLines = True
        
        'With .DataSource
            '.FirstRecord = wdDefaultFirstRecord
            '.LastRecord = wdDefaultLastRecord
        'End With
        
        '.Execute True
    End With
   
    'ThisDocument.Close wdDoNotSaveChanges

End Sub

Private Sub Document_Close()

    On Error Resume Next
   
    ThisDocument.MailMerge.MainDocumentType = wdNotAMergeDocument

End Sub

¤ë¾ä³]­p¨t²Îv5.0

VBA·½½X¤½¶}
¨ç¼Æ¤½¦¡¤½¶}
¥\¯àÅܼƤ½¶}

¤ë¾ä³]­p¨t²Îv5.0.zip (608.55 KB)

Word§e²{·¥­PªºÀRºA¤§¬ü¡AExcel®i²{·¥­Pªº°ÊºA¤§¬ü¡C

·PÁ¤À¨É¡I

TOP

        ÀR«ä¦Û¦b : ¡i»X½ªªº¦Û¥Ñ¡j¤H±`¦b¤°»ò³£¥i¥H¦Û¥Ñ¦Û¦bªº®É­Ô¡A«o³Q³oºØÀH¤ß©Ò±ýªº¦Û¥Ñ»X½ª¡AµêÂY®É¥ú¦Ó²@µLıª¾¡C
ªð¦^¦Cªí ¤W¤@¥DÃD