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

¼g¤@­Ó¥t¦s·sÀɪº¥¨¶°¡A¦ý¬O»Ý­n.pdf file¡A¨º»òÀ³«ç§ï¼g¡H

¦^´_ 10# Blade
¨C¦¸µo³æ®É¡A¥t¦s«á³£¬O®æ¦¡ INV12345_·|­û½s¸¹1_«È¤á¦WºÙ1.pdf
¨ì¤F¤U¤@±i³æ®É¡A¦o¤S§Ñ¤F§ó§ïINV12345¡A¦]¦¹·|¥X²{ INV12345_·|­û½s¸¹2_«È¤á¦WºÙ2.pdf
½Ð°Ý:¬°¦ó·|¦Û°Ê¥[1??


  1. Option Explicit
  2. Sub Ex()
  3.     ChDrive "C:\"            'Âà´«¨Ï¥Î¤¤ªººÏºÐ¾÷
  4.     ChDir "C:\test"          '§ïÅܨϥΤ¤¥Ø¿ý©ÎÀɮק¨¡C
  5.     ChDir "D:\test"          '§ïÅÜ«D¨Ï¤¤ºÏºÐ¾÷¥Ø¿ý©ÎÀɮק¨
  6.     MsgBox CurDir            '¶Ç¦^¨Ï¥Î¤¤ºÏºÐ¾÷:ªºªº¸ô®|
  7.     ChDrive "D:\"            'Âà´«¨Ï¥Î¤¤ªººÏºÐ¾÷
  8.     MsgBox CurDir            '¶Ç¦^¨Ï¥Î¤¤ºÏºÐ¾÷:ªºªº¸ô®|
  9.     '** ¦p³o¼Ë¨Ï¥Î¤¤ªººÏºÐ¾÷¤£¬Od
  10.     If Mid(CurDir, 1, 1) <> "d" Then ChDrive "d:\"
  11.     ChDir "d:\Account book\INV\"
  12.    
  13.    
  14.    ' **** ©Î¬O¥[¤W¸ô®|****
  15.     ActiveWorkbook.SaveAs Filename:="d:\Account book\INV\" & File_Name

  16.     File_Name = Replace(LCase(File_Name), "*.xlsm", ".dbf")  '°ÆÀɦW´À´«¬° "dbf"

  17.     ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
  18.         "d:\Account book\INV\" & File_Name, Quality:=xlQualityStandard, _
  19.         IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
  20. '    ***************
  21. End Sub
½Æ»s¥N½X

TOP

¦^´_ 11# GBKEE
À³¸Ó¬O¡G
µo²¼½s¸¹_·|­û½s¸¹_·|­û¦WºÙ
INV12345_1122_©P¨ÌÀM.pdf (³oµo²¼¦¨¥\¦C¦L¤Î¦sÀÉ)
¦ý·í¥t¤@¦ì¦P¨Æ¶}·sµo²¼®É¡A¦o¤S§Ñ¤F§ó§ïµo²¼½s¸¹¥u§ó·s¤F·|­û¸ê®Æ¦ý¤Sª½±µ¦C¦L¤Î¦sÀÉ
«K·|¥X²{¤F¬Û¦Pªºµo²¼½s¸¹¦p¤U¡G
INV12345_1155_¦¶¤d³·.pdf
·|­û¦¬¶O¸ê®Æ§ó·s¤F¡A¦ý¬Oµo²¼½s¸¹­«½Æ¤F
·|­û½s¸¹¤Î·|­û¦WºÙ¬O·|±`±`­«½Æªº¡A¦ýµo²¼½s¸¹¤£¯à­«½Æ¡A©Ò¥HÀɦW¯à¤£¯à¥u°w¹ïµo²¼½s¸¹¤£¯à­«½Æ§@¥X´£¥Ü

TOP

¦^´_ 12# Blade
  1. If Dir("¦s©ñ¸ê®Æ§¨¥þ³¡¸ô®|\" & "[µo²¼½s¸¹]" & "*.pdf ") <> "" Then
  2.         MsgBox "µo²¼½s¸¹ ¤w¶}¥X"
  3.         Exit Sub
  4.     End If
½Æ»s¥N½X

TOP

¦^´_ 13# GBKEE

§Ú¥[¤F¦b¡§¬õ¦â¡¨¨º³B¡A¤£¯à¦¨¥\¹B§@¡A§Ú¬O§_©ñ¿ù¦ì¸m©Î¥´¿ù¬Æ»ò¡H

        Option Explicit
    Sub Print_and_SavePDF()
        Dim File_Name As String, xFile As String, xSNo As String, xName As String
        xFile = Range("D6")
        xSNo = Range("L7")              'xSNo «K¬Oµo²¼½s¸¹ªº¦ì¸m
        xName = Range("M7")
                File_Name = xFile & "_" & xSNo & "_" & xName & ".pdf"
                                ActiveWorkbook.Save
ChDrive "D:\"
If Mid(CurDir, 1, 1) <> "d" Then ChDrive "d:\"
ChDir "d:\Account book\INV\"
If Dir("d:\Account book\INV\" & " xSNo " & "*.pdf ")<> "" Then
MsgBox "µo²¼½s¸¹ ¤w¶}¥X"
Exit Sub

          Do
            File_Name = InputBox("¥t¦s·sÀÉ", "[ÀɮצsÀÉ]", File_Name)
            If File_Name = "" Then
                Exit Sub
            Else
                If Dir(File_Name) <> "" Then
                    If MsgBox("¡iª`·N¡jÀɮצWºÙ¤w¸g¦s¦b¡C¬O§_­nÂл\¥¦¡H¦pÂл\¥¦¸ê®Æ±N·|³Q§ó·s¡C", vbYesNo) = vbYes Then
                        Exit Do
                    Else
                        File_Name = ""
                    End If
                End If
            End If
End If
        Loop While Not UCase(File_Name) Like "*.PDF"
        ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=xFile & "_" & xSNo & "_" & xName & ".pdf", Quality:=xlQualityStandard _
        , IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
     ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
        IgnorePrintAreas:=False
    Range("N13").Select
     
End Sub

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2012-12-22 07:19 ½s¿è

¦^´_ 14# Blade
  1. If Dir("d:\Account book\INV\*" &  xSNo  & "*.pdf ") <> "" Then
½Æ»s¥N½X

TOP

¦^´_ 15# GBKEE
¦¨¥\¹B¦æ¡A¦ý¬O­«½Æ µo²¼½s¸¹ ¨S¦³³Q´£¥Ü

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2012-12-22 07:20 ½s¿è

¦^´_ 16# Blade
  1.      If Dir("d:\Account book\INV\*" & xSNo  & "*.pdf ")<> "" Then
  2.      MsgBox "µo²¼½s¸¹   "& xSNo&"   ¤w¶}¥X"
  3.     Exit Sub
½Æ»s¥N½X

TOP

¦^´_ 17# GBKEE
´ú¸Õ¤F´X¦¸¡A¨Ì¤@¼Ë¡A¬Û¦Pªºµo²¼½s¸¹¥i¥H­«½Æ¦sÀÉ
INV12345_1122_©P¨ÌÀM.pdf
INV12345_1123_§õ¤lÀs.pdf
INV12345_1124_¦¶¥¿©_.pdf

·PÁª©¤j:D

¥Ñ©óµo²¼½s¸¹¬O¤H¥´Áä¤Jªº¡A¦]¦¹¥X¿ù¬O¸g±`µo¥Í¡C
¦pªG´«¥t¤@­Ó¤è¦¡¡A¥[¤J¦Û°Ê½s¸¹¡A©óÀx¦s®æ¤º¡A§Y¬O¨C¦¸¥t¦s·sÀÉ«á¡A³£·|¸õ¤@­Ó·sªº½s¸¹¥X¨Ó¡A«KªÖ©w¤£·|¥X¿ù¡C

2012-12-21_164758.jpg (84.12 KB)

2012-12-21_164758.jpg

TOP

¦^´_ 18# Blade
¤W¶Ç¦sÀɳo¤u§@ªí,¬Oµ{¦¡½X ¬Ý¬Ý

TOP

¥»©«³Ì«á¥Ñ Blade ©ó 2012-12-22 01:05 ½s¿è

¦^´_ 19# GBKEE
  1. Option Explicit

  2. Sub ¥t¦s·sÀÉ´ú¸Õ()
  3. Dim File_Name As String, xFile As String, xSNo As String, xName As String
  4.         xFile = Range("D6")
  5.         xSNo = Range("L7")
  6.         xName = Range("M7")
  7.                 File_Name = xFile & "_" & xSNo & "_" & xName & ".pdf"
  8.                                 ActiveWorkbook.Save
  9. ChDrive "D:\"
  10. If Mid(CurDir, 1, 1) <> "d" Then ChDrive "d:\"
  11. ChDir "d:\Account book\INV\"
  12. If Dir("d:\Account book\INV\*" & " xSNo " & "*.pdf ") <> "" Then
  13. MsgBox "µo²¼½s¸¹   "&  xSNo &"   ¤w¶}¥X"
  14. Exit Sub
  15.         End If
  16.           Do
  17.             File_Name = InputBox("¥t¦s·sÀÉ", "[ÀɮצsÀÉ]", File_Name)
  18.             If File_Name = "" Then
  19.                 Exit Sub
  20.             Else
  21.                 If Dir(File_Name) <> "" Then
  22.                     If MsgBox("¡iª`·N¡jÀɮצWºÙ¤w¸g¦s¦b¡C¬O§_­nÂл\¥¦¡H¦pÂл\¥¦¸ê®Æ±N·|³Q§ó·s¡C", vbYesNo) = vbYes Then
  23.                         Exit Do
  24.                     Else
  25.                         File_Name = ""
  26.                     End If
  27.                 End If
  28.             End If
  29.                    Loop While Not UCase(File_Name) Like "*.PDF"
  30.         ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=xFile & "_" & xSNo & "_" & xName & ".pdf", Quality:=xlQualityStandard _
  31.         , IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True

  32. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : µoµÊ®ð¬Oµu¼ÈªºµoºÆ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD