Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9229821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:40:04+00:00 2026-06-18T05:40:04+00:00

As a followup to this question about using images stored in an Excel file

  • 0

As a followup to this question about using images stored in an Excel file on a button in the ribbon:

Is it possible to use an image stored in a CustomXMLPart/CustomXMLNode in base64-encoded string as an image in an Office document without first saving it to disk and loading it back?

The place where I want to use the image takes an IPictureDisp object as a parameter (like the LoadPicture function returns, but that will only load files from disk).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T05:40:05+00:00Added an answer on June 18, 2026 at 5:40 am

    First you need to convert your base_64 data to byte array:

    Private Function decodeBase64(ByVal strData As String) As Byte()
        Dim objXML As MSXML2.DOMDocument
        Dim objNode As MSXML2.IXMLDOMElement
    
        Set objXML = New MSXML2.DOMDocument
        Set objNode = objXML.createElement("b64")
        objNode.DataType = "bin.base64"
        objNode.Text = strData
        decodeBase64 = objNode.nodeTypedValue
    
        Set objNode = Nothing
        Set objXML = Nothing
    End Function
    

    from: http://thydzik.com/vb6vba-functions-to-convert-binary-string-to-base64-string/

    then you can load it in memory and create your IPictureDisp using information on this topic: http://www.xtremevbtalk.com/showthread.php?t=137857

    Type GUID
      Data1 As Long
      Data2 As Integer
      Data3 As Integer
      Data4(7) As Byte
    End Type
    
    Private Declare Function CreateStreamOnHGlobal Lib "ole32.dll" (ByRef hGlobal As Any,     ByVal fDeleteOnResume As Long, ByRef ppstr As Any) As Long
    Private Declare Function OleLoadPicture Lib "olepro32.dll" (ByVal lpStream As IUnknown, ByVal lSize As Long, ByVal fRunMode As Long, ByRef riid As GUID, ByRef lplpObj As Any) As Long
    Private Declare Function CLSIDFromString Lib "ole32.dll" (ByVal lpsz As Long, ByRef pclsid As GUID) As Long
    
    Private Const SIPICTURE As String = "{7BF80980-BF32-101A-8BBB-00AA00300CAB}"
    
    Public Function PictureFromArray(ByRef b() As Byte) As IPicture
      On Error GoTo errorhandler
    
      Dim istrm As IUnknown
      Dim tGuid As GUID
    
      If Not CreateStreamOnHGlobal(b(LBound(b)), False, istrm) Then
        CLSIDFromString StrPtr(SIPICTURE), tGuid
        OleLoadPicture istrm, UBound(b) - LBound(b) + 1, False, tGuid, PictureFromArray
      End If
    
      Set istrm = Nothing
      Exit Function
    errorhandler:
      Debug.Print "Could not convert to IPicture!"
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As a followup to this question , is it possible to write a single
This is a followup question to my other question : Run bat file in
This is a followup to my earlier question about deciding if a hand is
[ Note: This is a followup to the question about running an Android service
This is a follow up to my previous question about using XMLHttpRequest() to post
This question is a followup to a previous question I had about discovering unused
This is a followup to my question about programmatically adding wordpress categories based on
This is a follow-up to my question about using multi-line regex in Vim .
Follow up to this question about GNU make : I've got a directory, flac
This is a follow up question to a previous question I asked about calculating

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.