# VBScipt convert Xls pages to PDF

**URL:** <https://forum.robusta.ai/t/vbscipt-convert-xls-pages-to-pdf/109>\
**Category:** FAQ\
**Created:** [April 29, 2022, 1:58pm UTC](https://forum.robusta.ai/t/vbscipt-convert-xls-pages-to-pdf/109 "2022-04-29T13:58:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ilayda.ipar](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robusta.ai/ilayda.ipar/32/56_2.png) [@ilayda.ipar](https://forum.robusta.ai/u/ilayda.ipar)\
**Post date:** [April 29, 2022, 1:58pm UTC](https://forum.robusta.ai/t/vbscipt-convert-xls-pages-to-pdf/109/1 "2022-04-29T13:58:06Z")

</div>

Use to convert all sheets in Xls to PDF separately

⬇

```auto
Dim objExcel
Dim objWorkBook
fileName="C:\RobustaWorkspace\out\result.xls"
'Instantiate Excel
Set objExcel = CreateObject("Excel.Application")
'open the xls file
Set objWorkBook=objExcel.Workbooks.Open(fileName)
For Each ws In objWorkBook.Worksheets
ws.ExportAsFixedFormatxlTypePDF,"C:\RobustaWorkspace\out"& ws.Name & ".pdf"
Next
'close workbook
objWorkBook.Close 'False
'quit excel
'objExcel.Quit

'clean up
'Set objWorkBook = Nothing
'Set objExcel = Nothing

```
