Macro to Publish as PDF

L

lfullam1

Hello all,

So I have a sheet within a workbook that I am wanting to save/publish a
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
make define the directory string such that a multitude of users o
different computers can all run this macro?

Thanks in advance
 
C

Claus Busch

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top