0

I created a workbook in which would be a chart to input data and stored in the same workbook. I managed to create a save path in which the PDF file would be stored but I also need in the same code the coding for saving the sheet in the same workbook as a continuation.

This is what I come up so far for only saving in the PDF format.

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="D:" & Range("H60").Value & Format(Date, "ddmmyyyy")

If somebody could help me would be much appreciated.

Pᴇʜ
  • 56,719
  • 10
  • 49
  • 73
  • 1
    Can you explain what you mean by "saving the sheet in the same workbook as a continuation"? – BigBen May 18 '20 at 14:04
  • 1
    What is in H60? The file path (i.e. folder name etc.) or the file name? – Steven Byrne May 18 '20 at 14:06
  • 1
    What do you mean by *"in which would be a chart to input data and stored in the same workbook."*? Do you really mean a "chart" here? A chart is a graphic and you cannot input data there. Do you mean a form? Or even a UserForm? – Pᴇʜ May 18 '20 at 14:07
  • Maybe this would help: https://stackoverflow.com/questions/61060302/excel-vba-creates-a-folder-sub-folders-and-further-sub-folders – Steven Byrne May 18 '20 at 14:14
  • Sorry for my bad phrasing. In "Chart" i mean like a table. The table contains cells which would be filled with information like names, describtions, time etc. So basically i want the table to be saved in two ways. First external in a specific path as a PDF file and in the same workbook where my table would be. I've added a button which deletes all the cells that would be filled and reuse the table for the next project. So at the end i would have one excel file with the saved data and on a external path i would have the table as PDF. Hope the description helps a little more :) – Earndilz May 19 '20 at 05:02

1 Answers1

0

Suppose the path is on sheet1

dim path as string 'path variable that stores the path

path="D:" & sheet1.Range("H60").Value & Format(Date, "ddmmyyyy")

'sheets to export
'they must be selected before exporting.
'ThisWorkbook.Sheets(Array("Sheet1", "Sheet2",...)).Select

ThisWorkbook.Sheets(Array("Sheet1", "Sheet2")).Select

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= path, _
     Quality:= xlQualityStandard, IncludeDocProperties:=True, _
     IgnorePrintAreas:=False, OpenAfterPublish:=True

I hope it helps you

merlinkes
  • 11
  • 3