使用vba

时间:2018-02-07 23:53:18

标签: vba pdf

我想打开一个PDF文件并打印我指定的子地址,但是当我使用Application.SendKeys“(%{1068})”时,只需打印屏幕Userform。我的问题是如何打印屏幕只是子评级更改。

enter code here
Private Sub AlteraRating_Click()
Dim strFolde As String, Month As String, Year As String, strFile As String

Month = Format(SalvaData, "mm")
Year = Format(SalvaData, "yyyy")
pdfData = Format(SalvaData, "yyyymmdd")
strFolder = "C:\Report\Report of Investments\" & Year & "\" & Month & "\"


strFile = strFolder & "RAI_INFRAPREV PLANO CV_F03148_" & pdfData & ".pdf"
ThisWorkbook.FollowHyperlink strFile, "Rating Changes"

Application.SendKeys "(%{1068})"
DoEvents

End Sub

1 个答案:

答案 0 :(得分:0)

尝试使用以下代码打开PDF,FollowHyperlink将无法打开足够长的时间来打印屏幕。

Dim shell As Object
Set shell = CreateObject("WScript.Shell")
shell.Run Chr(34) & strFile & Chr(34), 1, False