ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to Publish as PDF (https://www.excelbanter.com/excel-programming/448757-macro-publish-pdf.html)

lfullam1

Macro to Publish as PDF
 
Hello all,

So I have a sheet within a workbook that I am wanting to save/publish as a PDF file. the code i have thus far is :

Sub Publish2()
'
' Publish2 Macro
'

'
Sheets("bat").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\Liam\Desktop\BAT review.pdf", Quality:=xlQualityStandard _
, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
True
End Sub

Nice and simple and does the trick. The question I have is how can I make define the directory string such that a multitude of users on different computers can all run this macro?

Thanks in advance!

Claus Busch

Macro to Publish as PDF
 
Hi Liam,

Am Tue, 14 May 2013 16:30:09 +0100 schrieb lfullam1:

Nice and simple and does the trick. The question I have is how can I
make define the directory string such that a multitude of users on
different computers can all run this macro?


try:
Filename:="C:\Users\" & Application.UserName & _
"\Desktop\BAT review.pdf"


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2


All times are GMT +1. The time now is 03:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com