Export excel sheet as PDF to an existing folder

SSF1590

Board Regular
Joined
Oct 20, 2019
Messages
73
Hello again. I just realized that I have a picture in my worksheet that is not being copy when I export along with the pdf file. Is it possible for the picture to be saved as well?
 

SSF1590

Board Regular
Joined
Oct 20, 2019
Messages
73
Hi John. thank you for your feedback. I have 3 pictures in the sheet I export as pdf and neither of them saved in the pdf file. Do you have any idea what could be?

This is the code,

Dim File As Variant
Dim FileSpec As Variant
Dim Path2 As Variant
Dim Wks As Worksheet

Set Wks = ThisWorkbook.Worksheets("CARForm")
Sheets("CARForm").Visible = True

' // User input file name
File = TextBox1

' // Parent folder path
Path2 = "C:\Users\SS1590\Desktop\CAR Project\Folders"

' // Add final "" to the full file path if needed
FileSpec = IIf(Right(Path2, 1) <> "", Path2 & "" & File, Path2 & File)

' // If the folder does not exist then create it
If Dir(FileSpec, vbDirectory) = "" Then MkDir FileSpec

' // Save the worksheet as a PDF file
Wks.ExportAsFixedFormat xlTypePDF, FileSpec & "" & File & ".pdf"
 

Forum statistics

Threads
1,081,690
Messages
5,360,614
Members
400,592
Latest member
badgergurl

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top