访问VBA-将访问表单导出为PDF,然后关闭Adobe Reader [英] Access VBA - Export Access Form to PDF then Close the Adobe Reader

查看:541
本文介绍了访问VBA-将访问表单导出为PDF,然后关闭Adobe Reader的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Access中有一个VBA代码,可以将3个单独的Access表单导出/保存为PDF以便进行记录.但是,完成后,Adobe Reader将打开已保存的表单,要求处理器手动关闭所有3个表单. 3种形式听起来并不多,但它们将为我们所有239个实体连续完成此过程!这意味着他们将不得不每天手动单击关闭"超过700次!效率非常重要.

I have a VBA code in Access that exports/saves 3 seperate Access Forms to a PDF for record purposes. However, upon completion, Adobe Reader opens the Forms that were saved, requiring the processor to manually close all 3 forms. 3 forms doesn't sound like much but they will be completing this process continuously for all 239 of our entities! This means they will have to manually click Close over 700 times a day! So much for efficiency.

是否有VBA代码在Adobe Reader中关闭PDF?

Is there a VBA code to close the PDF in Adobe Reader?

下面是我当前正在使用的代码:

Below is the code that I am currently using:

Private Sub Command4_Click()
DoCmd.SetWarnings False

DoCmd.OpenQuery "Add to Completed", acViewNormal
DoCmd.OpenQuery "Clear from Master", acViewNormal
DoCmd.OpenQuery "Completed Totals", acViewNormal
DoCmd.OpenQuery "Update AB Totals", acViewNormal
DoCmd.OpenQuery "Update CD Totals", acViewNormal
DoCmd.OpenQuery "Update EF Totals", acViewNormal
DoCmd.OpenQuery "Update YTD Total", acViewNormal

DoCmd.OpenForm "Form123-pg1", acPreview
DoCmd.PrintOut acPrintAll
**DoCmd.OutputTo acOutputForm, "Form123-pg1", acFormatPDF, "Z:\Corporate\SubProcess\2014\" & Format(Date - 30, "mmyy") & " - " & [Forms]![Deal_Nav]![cbo_UnitNo] & " ReportName Pg1.pdf", True**
DoCmd.Close acForm, "Form123-pg1", acSaveNo
DoCmd.OpenForm "Form123-pg2", acPreview
DoCmd.PrintOut acPrintAll
**DoCmd.OutputTo acOutputForm, "Form123-pg2", acFormatPDF, "Z:\Corporate\SubProcess\2014\" & Format(Date - 30, "mmyy") & " - " & [Forms]![Deal_Nav]![cbo_UnitNo] & " ReportName Pg2.pdf", True**
DoCmd.Close acForm, "Form123-pg2", acSaveNo
DoCmd.OpenForm "Form123-pg3", acPreview
DoCmd.PrintOut acPrintAll
**DoCmd.OutputTo acOutputForm, "Form123-pg3", acFormatPDF, "Z:\Corporate\SubProcess\2014\" & Format(Date - 30, "mmyy") & " - " & [Forms]![Deal_Nav]![cbo_UnitNo] & " ReportName Pg3.pdf", True**
DoCmd.Close acForm, "Form123-pg3", acSaveNo

Me.Requery
Me.Refresh
DoCmd.SetWarnings True

结束子

推荐答案

Acrobat在创建pdf后会打开,因为您告诉您.

Acrobat opens after creating your pdf because you tell it to.

DoCmd.OutputTo acOutputForm, "Form123-pg1", acFormatPDF, "Z:\Corporate\SubProcess\2014\" & Format(Date - 30, "mmyy") & " - " & [Forms]![Deal_Nav]![cbo_UnitNo] & " ReportName Pg1.pdf", True

如果将自动启动标志从True更改为False,则不会,并且您不必关闭任何内容.

If you change the AutoStart Flag from True to False then it won't and you don't have to close anything.

DoCmd.OutputTo acOutputForm, "Form123-pg1", acFormatPDF, "Z:\Corporate\SubProcess\2014\" & Format(Date - 30, "mmyy") & " - " & [Forms]![Deal_Nav]![cbo_UnitNo] & " ReportName Pg1.pdf", False

现在Docmd.OutputTo只会创建文件.

这篇关于访问VBA-将访问表单导出为PDF,然后关闭Adobe Reader的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆