¼g¤@Ó¥t¦s·sÀɪº¥¨¶°¡A¦ý¬O»Ýn.pdf file¡A¨º»òÀ³«ç§ï¼g¡H
- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
        
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2012-12-22 16:57 ½s¿è
¦^´_ 24# Blade - Option Explicit
- Sub ¥t¦s·sÀÉ´ú¸Õ()
- Dim File_Name As String, xFile As String, xSNo As String, xName As String
- xFile = Range("D6")
- xSNo = Range("L7")
- xName = Range("M7")
- File_Name = xFile & "_" & xSNo & "_" & xName & ".pdf"
- ActiveWorkbook.Save
- ChDrive "D:\" '¤wÂà´«ºÏºÐ¾÷ ³o¦æ¤£»Ýn 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¸¹ " & xSNo & " ¤w¶}¥X"
- Exit Sub
- End If
- 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
- 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
- µo²¼§ó·s
- End Sub
½Æ»s¥N½X- Sub µo²¼§ó·s()
- Dim xSNo As Range, i As Integer, y As Integer, R As Integer, RR As Integer
- Set xSNo = Range("L7")
- y = Len(xSNo) '[µo²¼½s¸¹]ªº¦r¦êÓ¼Æ
- For i = 1 To y
- If R = 0 And Mid(xSNo, i, 1) Like "[0-9]" Then R = i '§ä[µo²¼½s¸¹]¤¤²Ä¤@ӼƦr
- If Mid(xSNo, i, 1) Like "[!0-9]" Then RR = i '§ä[µo²¼½s¸¹]¤¤³Ì«áªº¤å¦r
- Next
- If RR > R Or R = 0 Or xSNo = 0 Then '¼Æ¦r¦b¤å¦r¤§«e(©Î¥u¦³¤å¦r),¥u¦³¼Æ¦r
- MsgBox " µo²¼¦³»~ !!!"
- Else
- xSNo = Mid(xSNo, 1, R - 1) & Format(Mid(xSNo,R) + 1, String((y - R + 1), "0"))
- End If
- '¦p y - R + 1 = 5
- '¦p :Format(568, String((y - R + 1), "0")) => Format(568, "00000") => 5¦ì¼Æ: 00568
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|