This is a discussion on how to use VBA to publish an excel worksheet as XPS document and save with a custom filename? within the Excel Questions forums, part of the Question Forums category; I would like to create a macro to produce an XPS document from an excel worksheet that can then be ...
I would like to create a macro to produce an XPS document from an excel worksheet that can then be saved with the anme of a value in a cell in another worksheet.
I need to use the print to microsoft office XPS document writer to create the XPS file as the document loses format when using the Save as or export as file type function.
The macro below enables me to publish as xps and open the save as dialogue box but as I intend to do this for many worksheets I would like to be able to automate the saving of each worksheet with a specific file name.
If anyone could advise how to modify the macro below to automate the saving process it would be much appreciated.
Dim i As Integer
For i = 1 To 3
ActiveCell.FormulaR1C1 = i
Application.ActivePrinter = "Microsoft XPS Document Writer on Ne00:"
"PRINT(2,1,2,1,,,,,,,,2,""Microsoft XPS Document Writer on Ne00:"",,TRUE,,FALSE)"