excel - Selecting Where PDF Files Save -
i'm relieved got code below work of community.
i have 1 more option on wishlist i'm struggling with. currently, code below save worksheet 3 way worksheet titled "post" separate pdf files folder select. triggered shape.
i'm trying make below code prompt folder select users can select pdf files saved, have ideas how this?
also, call shell @ bottom preferably open folder files saved, that's not necessary long users know files being saved :)
sub saveallpdf() dim integer dim fname string dim tabcount long tabcount = sheets("post").index 'set tabcount last cell want pdf ' begin loop. = 3 tabcount 'set = number of first sheet want pdf in order left right tabcount if sheets(i).visible <> xlsheetvisible else sheets(i) fname = .range("c15") & " " & .range("e13") & "-" & .range("b1") 'the fname above equaling cells pdf's filename 'the folder directory below pdf files saved .exportasfixedformat type:=xltypepdf, filename:= _ "c:\users\brandon\desktop\operation automated\rltemp\" & fname, quality:=xlqualitystandard, _ includedocproperties:=true, ignoreprintareas:=false, openafterpublish:=false end end if next call shell("explorer.exe" & " " & "c:\users\brandon\desktop\operation automated\rltemp\", vbnormalfocus) 'this opens folder pdfs saved end sub
you can use excel's filedialog object:
sub saveallpdf() dim integer dim fname string dim tabcount long tabcount = sheets("post").index 'set tabcount last cell want pdf dim dialog filedialog dim path string set dialog = application.filedialog(msofiledialogfolderpicker) dialog.allowmultiselect = false if dialog.show = -1 path = dialog.selecteditems(1) ' begin loop. = 3 tabcount 'set = number of first sheet want pdf in order left right tabcount if sheets(i).visible <> xlsheetvisible else sheets(i) fname = .range("c15") & " " & .range("e13") & "-" & .range("b1") 'the fname above equaling cells pdf's filename 'the folder directory below pdf files saved .exportasfixedformat type:=xltypepdf, filename:=path & "\" & fname, quality:=xlqualitystandard, _ includedocproperties:=true, ignoreprintareas:=false, openafterpublish:=false end end if next call shell("explorer.exe" & " " & path & "\", vbnormalfocus) 'this opens folder pdfs saved end if end sub
Comments
Post a Comment