vbCF位图变量未定义



我使用的是MS Access 2007 VBA。

我正在尝试将pdf转换为图像。我在网上找到了这段代码,但他们没有提供所有的参考。我的vbCFBitmap编译失败。有人知道这个参考资料是从哪里来的吗?

Dim MyAcro As New AcroApp
Dim MyPDF  As New AcroPDDoc
Dim MyPage As AcroPDPage
Dim MyPt As acrobat.AcroPoint
Dim MyRect As AcroRect
Dim MyData As DataObject
Dim strPathString As String
Dim MyPath As String
Dim SaveToPath As String
Dim mysavepath As String
MyPath = "\spfs1stoneLong Term Sharegentex_ppapsgentex_ppaps_rawSupplier Request Number 3034910, Gentex Part Number 345-2120-000 Revision (003).pdf"
mysavepath = "C:out"
' open the PDF
MyPDF.Open (MyPath)
Set MyPage = MyPDF.AcquirePage(0)
' Convert Point to Twips for document
Set MyPt = New AcroPoint
'Define the rectangle that contains the PDF form
Set MyRect = New acrobat.AcroRect
MyRect.Top = 0
MyRect.Left = 0
MyRect.Right = MyPt.x
MyRect.bottom = MyPt.y
' Copy the PDF image to the clip board
Call MyPage.CopyToClipboard(MyRect, MyRect.Left, MyRect.Top, 100)
' Capture image from clip board to data object
Set MyData = Clipboard.GetData(vbCFBitmap)
'Save the data object
SavePicture MyData, mysavepath
' Clean up
Set MyAcro = Nothing
Set MyPDF = Nothing
Set MyPage = Nothing
Set MyPt = Nothing
Set MyRect = Nothing
Set MyData = Nothing

这可能是VB6代码,而不是VBA。

vbCFBitmap是系统全局的,因此不使用任何引用导入。

然而,这只是Windows标准剪贴板格式的副本,因此vbCFBitmap等于2。您可以使用2。

最新更新