如何使用 SendKeys 单击访问报告
How to click through Access Report using SendKeys
在为我的访问报告创建 table 内容后,我终于到了代码工作的地步,并创建了 table 内容。
作为 Microsoft 的 instructions,我需要手动单击打印预览直到最后一页,以便创建目录。这行得通。
如何使用 SendKeys 点击访问报告?
到目前为止,这是我的代码...它运行完美,除了 SendKeys 什么都不做!
'Click through report so that TOC code is executed
Dim rptCurReport As Report
Set rptCurReport = Screen.ActiveReport
With rptCurReport
Application.DoCmd.SelectObject acReport, "rptFundSelectionList"
.Visible = True 'switch to false once code is ok
'go through all pages
For i = 1 To .Pages
SendKeys "{PGDN}", True
Next i
'DoCmd.Close acReport, "rptFundSelectionList"
End With
我终于自己解决了这个问题。这是代码。愿它能帮助其他可怜的人!
'Open report containing code to create TOC with list of ISINs from above
DoCmd.OpenReport "rptFundSelectionList", acViewPreview, , strWhere
Set dict = Nothing
'Click through report so that TOC code is executed
Dim rptCurReport As Report
Set rptCurReport = Screen.ActiveReport
With rptCurReport
Application.DoCmd.SelectObject acReport, .Name
.Visible = True 'switch to false once code is ok
'go through all pages
SendKeys "{End}", True
DoEvents
Application.DoCmd.SelectObject acReport, .Name
DoCmd.Close acReport, .Name, acSaveNo
End With
在为我的访问报告创建 table 内容后,我终于到了代码工作的地步,并创建了 table 内容。
作为 Microsoft 的 instructions,我需要手动单击打印预览直到最后一页,以便创建目录。这行得通。
如何使用 SendKeys 点击访问报告?
到目前为止,这是我的代码...它运行完美,除了 SendKeys 什么都不做!
'Click through report so that TOC code is executed
Dim rptCurReport As Report
Set rptCurReport = Screen.ActiveReport
With rptCurReport
Application.DoCmd.SelectObject acReport, "rptFundSelectionList"
.Visible = True 'switch to false once code is ok
'go through all pages
For i = 1 To .Pages
SendKeys "{PGDN}", True
Next i
'DoCmd.Close acReport, "rptFundSelectionList"
End With
我终于自己解决了这个问题。这是代码。愿它能帮助其他可怜的人!
'Open report containing code to create TOC with list of ISINs from above
DoCmd.OpenReport "rptFundSelectionList", acViewPreview, , strWhere
Set dict = Nothing
'Click through report so that TOC code is executed
Dim rptCurReport As Report
Set rptCurReport = Screen.ActiveReport
With rptCurReport
Application.DoCmd.SelectObject acReport, .Name
.Visible = True 'switch to false once code is ok
'go through all pages
SendKeys "{End}", True
DoEvents
Application.DoCmd.SelectObject acReport, .Name
DoCmd.Close acReport, .Name, acSaveNo
End With