VBA非常新,我设法创建脚本来生成和保存/电子邮件的PDF文件。到目前为止,我已经创建了一个工作表中的每个改变一个单独的行,例如:我认为我需要循环
Sheets("AM Dashboard").Select
Range("B5").Select
ActiveCell.FormulaR1C1 = "Employee1"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\Google Drive\Sales Reports\Employee1\Sales Dashboard_Employee1" & " " & Format(Date, "yyyymmdd") & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
Range("B5").Select
ActiveCell.FormulaR1C1 = "Employee2"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\Google Drive\Sales Reports\Employee2\Sales Dashboard_Employee2" & " " & Format(Date, "yyyymmdd") & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
我想这样做的是通过在Sheet2的A列的列表的代码循环,直到电池是空的,填充AM仪表板B5中的相应值。
因此,例如,A1将包含Employee1,A2 =和Employee2,A3 = Employee3等
创建一个独立的子/函数生成的PDF文件,并在一个循环中调用它。 – L42