EXCEL TOOLS
Excel Add-ins ที่พัฒนาโดยคุณสันติพงศ์ ณสุย (MVP Excel 2010-2020) ด้วยภาษา C# เพื่อแก้ไขปัญหาไฟล์ใหญ่ คำนวณนาน ทำงานช้า จัดการข้อมูลต่าง ๆ ที่ทำงานประจำวันได้อย่างสะดวกรวดเร็ว สนใจคลิกไปดูได้ที่นี่ครับ => Excel Tools
Excel Add-ins ที่พัฒนาโดยคุณสันติพงศ์ ณสุย (MVP Excel 2010-2020) ด้วยภาษา C# เพื่อแก้ไขปัญหาไฟล์ใหญ่ คำนวณนาน ทำงานช้า จัดการข้อมูลต่าง ๆ ที่ทำงานประจำวันได้อย่างสะดวกรวดเร็ว สนใจคลิกไปดูได้ที่นี่ครับ => Excel Tools
[code]
และปิดด้วย [/code]
ตัวอย่างเช่น [code]dim r as range[/code]
เพื่อให้แตกต่างจากข้อความทั่วไป สะดวกในการอ่านและทดสอบ (คลิกเพื่อดูตัวอย่าง)Code: Select all
Sub PrintToPDF()
Dim sFolderPath As String
Dim Path As String
Dim FName As String
On Error Resume Next
With ActiveSheet.PageSetup
.Zoom = 100
End With
Application.ScreenUpdating = False
sFolderPath = "C:\" & Range("A18").Value
If Dir(sFolderPath, vbDirectory) = "" Then
MkDir sFolderPath
End If
sFolderPath = "C:\" & Range("A18").Value
If Dir(sFolderPath, vbDirectory) = "" Then
MkDir sFolderPath
End If
sFolderPath = "C:\" & Range("A18").Value & "\" & "PDF"
If Dir(sFolderPath, vbDirectory) = "" Then
MkDir sFolderPath
End If
FName = ActiveSheet.Range("A19") & ".PDF"
Application.DisplayAlerts = False
ActiveWorkbook.ExportAsFixedFormat xlTypePDF, from:=1, to:=2, Filename:=sFolderPath & "\" & FName
Application.DisplayAlerts = True
Application.ScreenUpdating = True
MsgBox "ส่งออกไฟล์ไปไว้ที " & "C:\" & Range("A18").Value & "\" & "PDF" & "\" & FName
End Sub