我正在尝试确定程序中是否存在更快的方法来保存为pdf。当我运行以下代码时,保存我拥有的每个pdf文件大约需要25秒钟。我通过逐步检查代码来缩小了保存到pdf代码的瓶颈。我尝试将自动计算转换为手动,但这无济于事。
基本上,该脚本正在执行的工作是检查有多少借款人(客户包裹可能少于但不会超过4),然后填充一些数据,然后打印一些工作表。
这是我的代码:
`customerpackages = 0
For counter = 1 To 19
If Sheets("Loan Data").Cells(2, counter) <> "" Then
customerpackages = customerpackages + 1
counter = counter + 6
End If
Next counter
For j = 1 To (customerpackages * 2)
Sheets("Certification").Range("G43").Value = ssn_array(j - 1)
Sheets("Certification").Range("G46").Value = ssn_array(j)
Sheets("Anti-steering").Cells(3, 1).Value = borrower_array(j - 1)
Sheets("Anti-steering").Cells(4, 1).Value = borrower_array(j)
If borrower_array(j) = " " Then
Sheets("Rate Lock").Cells(10, 1).Value = "NAME : " & borrower_array(j - 1)
Else
Sheets("Rate Lock").Cells(10, 1).Value = "NAME : " & borrower_array(j - 1) & " and" & borrower_array(j)
End If
Worksheets(common_disclosures).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\users\" & environ_user & "\desktop\" & borrower_array(j - 1) & "
disclosures.pdf" _
, Quality:=xlQualityMinimum, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
j = j + 1
Next j`
预先感谢您的帮助。