首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

将MS Access"OLE Objects"转换回纯JPEG格式 - 最好的方法?

转换 MS Access "OLE Objects" 成纯 JPEG 格式最好的方法是使用 Access 的内置功能,使用 VBA (Visual Basic for Applications)脚本。以下是一段示例 VBA 代码:

代码语言:vbnet
复制
Sub ConvertOLEsToJPG()

  Dim oleobj As OLEObject
  Dim jpgImage As IPicture
  Dim olePicturePath As String
  Dim tempJPEGPath As String
  Dim i As Integer

  ' Loop through all the ole objects in the database
  For Each oleobj In CurrentProject.AllForms(0).Controls
     If TypeOf oleobj Is OLEObject Then
        ' Get the path to the OLE object picture
        olePicturePath = oleobj.Source

        ' Convert the OLE object to a JPEG image
        olePicturePath = Replace(olePicturePath, ".OLEO",".JPG")
        olePicturePath = Replace(olePicturePath, ".HLP","")
        Set jpgImage = CreateObject("jpeg.jpg")
        jpgImage.Src = olePicturePath

        ' Save the JPEG image to a temporary file in a hidden subfolder
        tempJPEGPath = ThisWorkbook.Path & "\temp\" & "ole_" & i & ".jpg"
        jpgImage.PictureType = 1
        jpgImage.Export tempJPEGPath
        i = i + 1
     End If
  Next oleobj

  ' Erase the subfolder if it exists
  Kill ThisWorkbook.Path & "\temp\"

  ' Delete the source OLE object pictures
  For i = 1 To ActiveWorkbook.Worksheets.Count
    ActiveWorkbook.Worksheets(i).OLEObjects("OLEPicture").Delete
  Next i

  Debug.Print "OLE Objects converted to JPEG: " & i & " files"
  Set jpgImage = Nothing
  Set oleobj = Nothing

End Sub

你可以直接运行这个 VBA 脚本来将 Access MDB 中的所有 OLE Objects (Object Linking and Embedding) 转換成纯 JPEG 格式,然后将转换后的 JPEG 文件存储在一个隐藏的子文件夹中。需要注意的是,这个方法不会将 OLEObject 图片转换成 Bitmap 或位图格式。

如果你需要进一步的帮助,我将很乐意提供帮助。

页面内容是否对你有帮助?
有帮助
没帮助

相关·内容

没有搜到相关的视频

领券