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

¦p¦ó¦b¥ÎwordŪ¨úexcel«ü©wÄæ¦ìªº­È

¦p¦ó¦b¥ÎwordŪ¨úexcel«ü©wÄæ¦ìªº­È

¥Ø«e¼g¤F¤@­Ó¼ÐÅÒµ{¦¡

¦]¬°¦³­Ó¸ê·Q§Q¥Îexcelªº­È
·í§@ÅÜ¼Æ¨Ó·í°µword¥t¦s·sÀɪº±K½X

§Ú¦bexcel¤º¼g¤J±K½X»{ÃÒªº¦Û­qªí³æ
¥u­n±K½X¥¿½T´N¥i¥H¬d¬Ý«È¤á¸ê®Æ§_«h
¬ÛÃö¸ê®Æ¬OÁôÂ꺵Lªk¬Ý¨ì«È¤á¸ê®Æ

§Ú¤]¦bµ{¦¡¤º¼g¤J§ó§ï±K½Xªºªí³æ
±K½X§ó§ï¦¨¥\´N·|¦bF1¼g¤J±K½X

§Ú­n«ç­Ì§Q¥Îword¨ú±oexcel
Àx¦s®æF1ªº­È

¥H¤U¬Oexcel§ó·s¸ê®Æ¥¨¶°§Ú§â
»{ÃÒ¼g¦b¸Ì­±¤F©Ò¥H°õ¦æ¤£»Ý­n¿é¤J±K½X
Application.ScreenUpdating = False

    Windows("¦í§}¼ÐÅÒ®M¦L®æ¦¡(¶}±Ò¦Û°Ê§¹¦¨).xlsm").Visible = True

    ActiveSheet.Unprotect Password:="9527"

    Cells.Select

    Range("H1").Activate

    Selection.EntireColumn.Hidden = False

    Range("A2").Select

    Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select

    Selection.Delete Shift:=xlUp

   Dim abc As String

    abc = ThisWorkbook.Path & "\"

    Workbooks.OpenText _

    Filename:=abc & "¸ê®Æ®w.txt", _

    DataType:=xlDelimited, _

    Comma:=True
.
.
.
.

 ³B²z¸ê®Æ

    Columns("A:G").Select

    Selection.EntireColumn.Hidden = True

    Range("H1").Select

    ActiveSheet.Protect Password:="9527"

    ActiveWorkbook.Save

    Set wo = CreateObject("word.application")

    wo.Visible = True

    wo.documents.Open ThisWorkbook.Path & "\¦í§}¼ÐÅÒ®M¦L®æ¦¡(¶}±Ò¦Û°Ê§¹¦¨).docm"

    Windows("¦í§}¼ÐÅÒ®M¦L®æ¦¡(¶}±Ò¦Û°Ê§¹¦¨).xlsm").Close SaveChanges = False

EXCEL¥¨¶°¡ô°õ¦æ§¹«á¦Û°Ê¶}±Òword
 
¥H¤U¬O§Ú¦bword¹Á¸Õ¼g¤Jªºvba µ²ªG³£¬O°õ¦æ¥¢±Ñ
Ps¥H¤Uµ{¦¡½X·|¶}±Ò§Ú¼gªºexcel¬¡­¶Ã¯
-------------------------------------------------------------------------------
   Dim ex As Object
    Set ex = CreateObject("excel.application")
    'wo = ThisDocument.Path & "\¦í§}¼ÐÅÒ®M¦L®æ¦¡(¶}±Ò¦Û°Ê§¹¦¨).xlsm"

   Set wo = ex.Workbooks.Open(ThisDocument.Path & "\¦í§}¼ÐÅÒ®M¦L®æ¦¡(¶}±Ò¦Û°Ê§¹¦¨).xlsm")

  ' "='[B.xls]Sheet1'!$A$1"
   ' With wo = Sheet1
    'Dim ex As Object
    'Set ex = CreateObject("Excel.Sheet")
'End With

   ¥H¤U¬O¶}±Òword«á¦Û°Ê°õ¦æ¦ý¬O¨S¦³¥[±K
---------------------------------------------------------------------------
    Application.ScreenUpdating = False

    abc = ThisDocument.Path & "\"

    ActiveDocument.MailMerge.MainDocumentType = wdFormLetters

    ActiveDocument.MailMerge.OpenDataSource Name:= _

        abc & "¦í§}¼ÐÅÒ®M¦L®æ¦¡(¶}±Ò¦Û°Ê§¹¦¨).xlsm", ConfirmConversions:=False, _

        ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _

       PasswordDocument:="", PasswordTemplate:="", WritePasswordDocument:="", _

        WritePasswordTemplate:="", Revert:=False, Format:=wdOpenFormatAuto, _

        Connection:= _

        "Provider=Microsoft.ACE.OLEDB.12.0;User ID=Admin;Data Source=abc;Mode=Read;Extended Properties=""HDR=YES;IMEX=1;"";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Engine Type=35;Jet OLEDB:Database Lock" _

        , SQLStatement:="SELECT * FROM `Sheet1$`", SQLStatement1:="", SubType:= _

        wdMergeSubTypeAccess

       ActiveDocument.MailMerge.Execute Pause:=True

    ActiveDocument.SaveAs FileName:= _

        abc & "¦í§}¼ÐÅÒ®M¦L(§¹¦¨).docx", FileFormat:= _

        wdFormatXMLDocument, LockComments:=False, Password:=(d), AddToRecentFiles _

        :=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts _

        :=False, SaveNativePictureFormat:=False, SaveFormsData:=False, _

        SaveAsAOCELetter:=False
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

        ÀR«ä¦Û¦b : Ä@­n¤j¡B§Ó­n°í¡B®ð­n¬X¡B¤ß­n²Ó¡C
ªð¦^¦Cªí ¤W¤@¥DÃD