如何检查过滤器是否有任何结果?
我应用多个过滤器(在数组中定义),通过它们运行并导出PDF。
当过滤器没有值时,代码停止,因为没有任何导出。
我正在使用在错误简历下
上使用,但这是不可持续的。如果错误发生两次,它将再次破裂。
如何检查过滤器是否有任何结果?
For i = 1 To 18
FilterApply name:=FL(i)
names = ActiveProject.ProjectSummaryTask.name & " " & FL(i)
DocumentExport FileName:="C:\temp\" & names, FromDate:="01/07/22 6:00", ToDate:="15/07/22 18:00", FileType:=pjPDF
Next
I apply multiple filters (defined in an array), run through them and export pdfs.
When a filter has no value the code stops because there is nothing to export.
I am using On Error Resume Next
but this is not sustainable. If the error happens twice it breaks again.
How can I check if the filter has any results?
For i = 1 To 18
FilterApply name:=FL(i)
names = ActiveProject.ProjectSummaryTask.name & " " & FL(i)
DocumentExport FileName:="C:\temp\" & names, FromDate:="01/07/22 6:00", ToDate:="15/07/22 18:00", FileType:=pjPDF
Next
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我找到了答案。实际上很容易!
I found the answer. quite easy actually!
我答案一个类似的问题以前在这里。我建议创建一个单独的函数以检查过滤器是否为空,
因此可以在代码中调用该方法:
I've answered a similar question on here before. I recommend creating a separate function to check if the Filter is empty, like this:
Then you can call the method in your code: