我有以下VBA代码:
Sub Button1_Click()
Const SAVE_PATH = "S:\Divisional Support\RVU Programs\Payroll 2015\2015-01 January\Provider Performance PDF's"
Dim cell As Range
Dim wsSummary As Worksheet
Dim counter As Long
Set wsSummary = Sheets("PERFORMANCE ANALYSIS")
For Each cell In Worksheets("MEMORIAL HOSPITAL OF YORK").Range("$A$200:$A$226")
If cell.Value <> "" Then
'progress in status bar
counter = counter + 1
Application.StatusBar = "Processing file: " & counter & "/1042"
With wsSummary
.Range("$A$6").Value = cell.Value
.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=cell.Value & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
End With
End If
Next cell
Set wsSummary = Nothing
End Sub
出于某种原因,我无法解释它没有在地点保存:S:\ Divisional Support \ RVU Programs \ Payroll 2015 \ 2015-01 January \ Provider Performance PDF's
相反它正在保存:S:\ Divisional Support \ RVU Programs \ Payroll 2015 \ Ryan的MOCK文件夹
任何帮助将不胜感激!
答案 0 :(得分:3)
您未在导出部分中使用SAVE_PATH
变量。尝试:
Filename:= SAVE_PATH & "\" & cell.Value & ".pdf"