0

I am trying to export an excel file (xlsx type)to PDF. not all the values are showing when i have formula.

Dim xl As Object
            xl = CreateObject("Excel.Application")
            Dim xwb As Object = xl.Workbooks.Open("C:\sahara\Code\OperationSummaryReport\Book1.xlsx")
            xwb.ActiveSheet.calculate()
            xwb.ActiveSheet.ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, "C:\sahara\Code\OperationSummaryReport\sample.pdf", _
            XlFixedFormatQuality.xlQualityStandard, _
            True, _
            True, _
            1, _
            10, _
            True)


            xl.Quit()
Yogesh Rathi
  • 6,331
  • 4
  • 51
  • 81
joseph
  • 11
  • 2
  • Possible duplicate of [Excel VBA to Export Selected Sheets to PDF](http://stackoverflow.com/questions/20750854/excel-vba-to-export-selected-sheets-to-pdf) – Abdulrahman Bres Aug 18 '16 at 12:15
  • No it's a different case. when i am trying to open Excel and save it manually as PDF it works. but when i tried to export from the code as pdf, i got #NAME? as value – joseph Aug 18 '16 at 12:20
  • even i tried another way by opening the Excel file and calculate and copy and paste using paste special and getting the same result.Dim wsSrc As Worksheet Dim wsDst As Worksheet wsSrc = excelWorkbook.Sheets("Sheet1") wsDst = excelWorkbook.Sheets("Sheet2") wsSrc.Activate() wsSrc.Calculate() wsSrc.Range("B2:B3").Copy() wsDst.Range("B2").PasteSpecial(XlPasteType.xlPasteValues, Transpose:=False) excelWorkbook.Sheets("Sheet1").Application.CutCopyMode = False – joseph Aug 18 '16 at 12:41

0 Answers0