สอบปัญหาการสั่งพิมพ์เป็น PDF
Posted: Tue Oct 04, 2022 3:28 pm
จากไฟล์ที่แนบ
และ Code
ปัญหาที่พบคือ นำไปใช้กับเครื่องหนึ่งที่เป็น วินโดว์ 11 excel 2016 ใช้ไม่ได้ มีปัญหาดังภาพ
แต่ใช้กับวินโดว์ 10 excel 2016 ใช้ได้ไม่มีปัญหา
เกิดจากสาเหตุใดครับ
และ Code
Code: Select all
Sub index01ToPdf()
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:\" & Range("B16").Value
If Dir(sFolderPath, vbDirectory) = "" Then
MkDir sFolderPath
End If
sFolderPath = "C:\" & Range("B16").Value & "\" & Range("B17").Value
If Dir(sFolderPath, vbDirectory) = "" Then
MkDir sFolderPath
End If
sFolderPath = "C:\" & Range("B16").Value & "\" & Range("B17").Value & "\" & "PDF"
If Dir(sFolderPath, vbDirectory) = "" Then
MkDir sFolderPath
End If
FName = ActiveSheet.Range("B18") & ActiveSheet.Range("B19") & ".PDF"
Application.DisplayAlerts = False
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=sFolderPath & "\" & FName
Application.DisplayAlerts = True
Application.ScreenUpdating = True
MsgBox "บันทึกไฟล์ไว้ที่" & "C:\" & Range("B16").Value & "\" & Range("B17").Value & "\" & "PDF" & "\" & FName
End Sub
แต่ใช้กับวินโดว์ 10 excel 2016 ใช้ได้ไม่มีปัญหา
เกิดจากสาเหตุใดครับ