我需要自动化一些程序。我编写了一些代码,将cdr文件发布为PDF:
Sub GlobalMacroStorage_DocumentOpen(ByVal doc As Document, ByVal FileName As String)
Set doc = ActiveDocument
With doc.PDFSettings
...{some code here}
.Linearize = True
.PageRange = "1,2"
.pdfVersion = pdfVersion13
.PublishRange = pdfPageRange
.TrueTypeToType1 = True
.TextAsCurves = True
.OverprintBlackLimit = True
End With
If Len(Dir(doc.FilePath + "\coreltmp", vbDirectory)) = 0 Then
MkDir doc.FilePath + "coreltmp"
End If
name2 = Dir(FileName) + "TEST.pdf"
strName = doc.FilePath & "coreltmp" & "\" & name2
doc.PublishToPDF strName
ActiveDocument.Close <<=====ERROR LINE
End Sub标记行出错:无法从文档事件处理程序关闭文档。所以问题是:在没有关闭整个应用程序的情况下,这个文档有多接近?
发布于 2016-01-15 04:21:09
在本例中,ActiveDocument. = doc =只需简单地使用:
doc.Closehttps://stackoverflow.com/questions/32780330
复制相似问题