snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Sub SaveToPdf()
Dim sFolderPath As String
Dim Path As String
Dim FName As String
On Error Resume Next
With ActiveSheet.PageSetup
.Zoom = 98
End With
Application.ScreenUpdating = False
sFolderPath = "C:\" & "Pasadu"
If Dir(sFolderPath, vbDirectory) = "" Then
MkDir sFolderPath
End If
sFolderPath = "C:\" & "Pasadu" & "\" & ActiveSheet.Range("A10").Value
If Dir(sFolderPath, vbDirectory) = "" Then
MkDir sFolderPath
End If
FName = ActiveSheet.Range("A11") & ".PDF"
Application.DisplayAlerts = False
ActiveWorkbook.ExportAsFixedFormat xlTypePDF, from:=1, to:=8, Filename:=sFolderPath & "\" & FName
Application.DisplayAlerts = True
Application.ScreenUpdating = True
MsgBox "ส่งออกไฟล์ไปไว้ที " & "C:\" & "Passadu" & "\" & ActiveSheet.Range("A10").Value & "\" & FName
End Sub
You do not have the required permissions to view the files attached to this post.
ลองใช้วิธีคัดลอกไปวางในชีตใดชีตหนึ่งที่สร้างขึ้นมาสำหรับการสร้าง PDF เฉพาะโดย Loop ไปใช้เฉพาะหน้าที่ต้องการ จากนั้นค่อย Export เป้น PDF จากหน้านั้นแทนครับ