Sub Xls2Pdf()
Dim a As Application: Set a = Application
On Error Resume Next: a.PrintCommunication = False
a.DisplayAlerts = False: a.ScreenUpdating = False
Dim fso, folder, files, NewsFile, sFolder, ws As Worksheet
Set fso = CreateObject("Scripting.FileSystemObject")
sFolder = "C:\Users\ppp\Desktop\새홀리기\"
Set folder = fso.GetFolder(sFolder)
Set files = folder.files
For Each folderIdx In files
If InStr(1, Right(folderIdx.Name, 5), ".xls", vbTextCompare) Then
Workbooks.Open Filename:=sFolder + folderIdx.Name
For Each ws In ActiveWorkbook.Sheets
ws.PageSetup.Zoom = False
ws.PageSetup.FitToPagesWide = 1
ws.PageSetup.FitToPagesTall = 0
Next
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=sFolder + Left(folderIdx.Name, Len(folderIdx.Name) - 4) + ".pdf"
ActiveWorkbook.Close SaveChanges:=False
End If
Next: a.PrintCommunication = True: Set a = Nothing
End Sub
다음과 같은 코드를 사용하여
폴더안에 있는 엑셀 파일을 페이지 설정 너비1 높이0으로 PDF 변환을 하였는데 높이 설정이 되지 않고 pdf 변환이 됩니다.
제가 원하는 변환 형태는 첨부된 PDF 파일입니다.
이상이 있는 부분좀 지적해주세요
부탁드립니다.