我使用此代码从word文档导出pdf文件.
在导出之前,我需要首先检查一个具有相同名称的文件是否已经打开,如果是这样,则将其导出.
我尝试了很多东西,但没有运气.
Dim adbApp As Acrobat.AcroApp
Dim adbDoc As Acrobat.AcroAVDoc
Dim adbPageView As Acrobat.AcroAVPageView
Set adbApp = CreateObject("AcroExch.App")
Set adbDoc = CreateObject("AcroExch.AVDoc")
If adbDoc.Open("C:\Current Letter Preview.pdf", "") = True Then '==> If the file is not open, this line opens it
adbDoc.Close (1) '==> Then close it
If adbDoc Is Nothing Then '==> Doesn't understand that I want to check if any pdf files are open
adbApp.Exit
End If
Set adbApp = Nothing
End If
Dim wordApp As Word.Application …Run Code Online (Sandbox Code Playgroud)