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

[µo°Ý] Á~¸ê³æ¦X¨Ö¦C¦L«á¡AÂন­Ó§OPDF¨Ã¥[±K

[µo°Ý] Á~¸ê³æ¦X¨Ö¦C¦L«á¡AÂন­Ó§OPDF¨Ã¥[±K

§Úªº°ÝÃD¸òexcelª©³o½g¤å¦³ÂIÃþ¦ü
http://forum.twbts.com/viewthread.php?tid=19785

¤½¥q·Q­n±NÁ~¸ê³æ¡A¥H¹q¤l¶l¥óPDF¥[±Kªº¤è¦¡¡A±Hµ¹¦P¤¯¡C

¤j­P·Qªk¬O¥Hexcel(Á~¸ê­pºâ³æ)¡A»PWORD(Á~¸ê®æ¦¡ÀÉ)¶i¦æ¦X¨Ö¦C¦L«á¡A
¶×¦¨¤@±i¤@±iªºPDF¨Ã¥[±K¡A
¦A¦Û°Ê±Hµo¹q¤l¶l¥ó+®µ±aÁ~¸êPDF¤å¥ó¡A±H¨ì­û¤u¥»¤Hªº¹q¤l«H½c¡C

½Ð°Ý¸Ó«ç»ò³]­p?  ·PÁ¦U¦ì¤j¯«

¦^´_ 1# amihoim


    ÁÂÁ«e½úµoªí¦¹¥DÃD»P½d¨Ò
«Øij«e½ú¤W¶ÇÁ~¸êºÞ²zÀɮשM²z·Q¤¤ªºpdfÀÉ
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 1# amihoim


Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim password As String

Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open("C:\Your\Excel\File\Path.xls")
Set xlSheet = xlBook.Sheets("Sheet1")

password = xlSheet.Cells(2, 1).Value '¨ú±o²Ä2¦C²Ä1Ä檺­È§@¬°±K½X

xlBook.Close SaveChanges:=False
xlApp.Quit

Dim password As String
Dim pdfFileName As String

'Ū¨úExcel¤å¥ó¤¤ªº±K½XÄæ¦ì
'¬Ù²¤Åª¨úExcelªºµ{¦¡½X

'³]¸mPDF¥[±K¿ï¶µ
Dim pdfSecurity As Object
Set pdfSecurity = CreateObject("AcroExch.PDDoc")
pdfSecurity.SetSecurity "user", "", 2, "", password, True '2¥Nªí128¦ìAES¥[±K

'Âà´«Word¬°PDF
pdfFileName = "C:\Your\PDF\File\Path.pdf"
ActiveDocument.ExportAsFixedFormat OutputFileName:=pdfFileName, ExportFormat:=wdExportFormatPDF, _
    OpenAfterExport:=False, OptimizeFor:=wdExportOptimizeForPrint, Range:=wdExportAllDocument, _
    Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
    CreateBookmarks:=wdExportCreateNoBookmarks, _
    DocumentStructureTags:=True, _
    SecurityDescriptor:=pdfSecurity

Dim i As Integer
Dim pageNum As Integer

'¨ú±o­¶­±Á`¼Æ
pageNum = ActiveDocument.ComputeStatistics(wdStatisticPages)

'¹M¾ú¨C­Ó­¶­±
For i = 1 To pageNum
    '¦b¦¹²K¥[±N¨C¤@­¶­Ó§O¥t¦s¬°¥[±KPDFªºµ{¦¡
Word§e²{·¥­PªºÀRºA¤§¬ü¡AExcel®i²{·¥­Pªº°ÊºA¤§¬ü¡C

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡¦¨´N¤@¤Á¡j®É¶¡¥i¥H³y´N¤H®æ¡A¥i¥H¦¨´N¨Æ·~¡A¤]¥i¥HÀx¿n¥\¼w¡C
ªð¦^¦Cªí ¤W¤@¥DÃD