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

½Ð°Ý¥ÎVBA°õ¦æWORD¦X¨Ö¦C¦L¤Î¨äÀ³¥Î

½Ð°Ý¥ÎVBA°õ¦æWORD¦X¨Ö¦C¦L¤Î¨äÀ³¥Î

½Ð°Ý¦U¦ì«e½ú
§Ú·Q¦bExcel¤¤©ñ¤@­Ó«ö¶s¡A«ö¤U«á·|¶}±Ò«ü©wªºwordÀÉ¡A¨Ã±NExcel¤¤ªº¸ê®Æ®M¦L¨ìword(¦X¨Ö¦C¦L)¡A¸Ó«ç»ò¼g©O?
¤ñ¦p»¡¡Aexcel¤¤¦³¨â­ÓÄæ¦ì¡A¤@¬O¾Ç¸¹¡A¤@­Ó¬O©m¦W¡AÁ`¼Æ¦³10­Ó¾Ç¥Í
word¤¤¡A©m¦Wªº«á­±­n´¡¤J¦X¨ÖÄæ¦ì¡m©m¦W¡n¡A¾Ç¸¹¥ç¦P¡A®M¦L«á·|¦³10±i
ª½±µ¶}word¾Þ§@¦X¨Ö¦C¦L¬O¨S°ÝÃD¡A¦ý¬O­n¥Î«ö¶s§Ú´N¤£·|¤F


<¶i¶¥À³¥Î>
word¬O¾Ç¥Íµû»y¥d¡A¦³1~12®æ¡A¨C¤ë¤@®æ¡A­n¿é¤J1µû»y
excel¤¤§Ú©ñ¤J400µ§¦W¨¥¨Î¥y(½s¸¹¡B¨Î¥y)
³]¤@«ö¶s¡A¤@­Ótextbox(¤â°Ê¿é¤J©ñ²Ä´X®æ)¡A¥t¤@­Ótextbox(­n¦L´X¥÷)
¤ñ¦p²{¦b4¤ë¡A­n¦L38¥÷¡A¨Î¥y­n©ñ²Ä4®æ¡A«ö¤U«ö¶s«á·|ÀH¾÷±qexcelªº400µ§¤¤©â¨ú38µ§
«á°õ¦æ¦X¨Ö¦C¦L¨ìword¤W¡A(®M¦L¨ì²Ä4®æ¡A¦@¦³38¥÷)
³o­n¦p¦ó¹F¦¨©O?


<§ó¶i¶¥À³¥Î>
word¬O¾Ç¥Í°ò¥»¸ê®Æ¥d¡A¦³¾Ç¸¹¡B©m¦W¡B¦í§}¡B¹q¸Ü
access¤¤¦s¦³¤W­z¦UºØ¾Ç¥Í¸ê®Æ¡A¦@200­Ó¾Ç¥Í
excel¤¤³]¤@«ö¶s¡A¤@­Ótextbox(¿é¤J·Q¦L­þ¤@¦ì¾Ç¥Íªº¾Ç¸¹)
«ö¤U«ö¶s«á·|¨Ìtextboxªº¾Ç¸¹¥haccess¸ê®Æªí¤¤¼´¸ê®Æ¡A¨Ã¦X¨Ö¦C¦L¨ìword¤¤¬Û¹ïÀ³ªºÄæ¦ì


¬Ý¤F¤@¨Ç¤å¦ýÁÙ¬O·d¤£¦n¡A¤]¤£À´¡A¥u¦nµo°Ý¨D§U
¦pªG¶i¶¥ÃD¤ÓÃøªº¸Ü¡A´N½Ð¦U¦ì«e½úÀ°¦£¥ý¸Ñµª²Ä¤@ÃD´N¦n
·PÁ·PÁÂ

ps:¦pªG«ö¤U«ö¶s«á¡A¦X¨Ö§¹ª½±µ¦C¦L¡A¦n¹³¦³printªº«ü¥O
     ¦ý¦pªG§Ú¦³¨â¥x¦Lªí¾÷¡A¥i¥H§Q¥Î«ü¥O¥h«ü©w§Ú³o¦¸­n¥ÎA¦Lªí¾÷¥h¦L
     ©Î¬O­n«ü©wB¦Lªí¾÷¥h¦L¶Ü?      ÁÂÁÂ
«¢Åo~¤j®a¦n§r

¥»©«³Ì«á¥Ñ linyancheng ©ó 2020-4-1 14:24 ½s¿è

¦^´_ 1# iceandy6150


¦bExcel¤¤¡G

Shell "rundll32.exe url.dll,FileProtocolHandler " & ThisWorkbook.Path & "\¡³¡³¡³¡³¡³.doc", 1 '¡u¡³¡³¡³¡³¡³.doc¡v§ï¦¨WordÀɦW¡C°²³]WordÀɦb¦P¤@¸ê®Æ§¨¤¤¡C

¦bWord¤¤¡G

¦­´Áª©¥»¬O¬Û¹ï¸ô®|¡AOffice 2007¥H«á¬Oµ´¹ï¸ô®|¡C
¬°ÁקK³Â·Ð¡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
Word§e²{·¥­PªºÀRºA¤§¬ü¡AExcel®i²{·¥­Pªº°ÊºA¤§¬ü¡C

TOP

        ÀR«ä¦Û¦b : ¤@­Ó¯Ê¤fªºªM¤l¡A¦pªG´«¤@­Ó¨¤«×¬Ý¥¦¡A¥¦¤´µM¬O¶êªº¡C
ªð¦^¦Cªí ¤W¤@¥DÃD