How to convert an attached image to Base64 format.
Solved/Closed
Raj_1562
Posts
29
Registration date
Wednesday August 26, 2020
Status
Member
Last seen
August 29, 2022
-
Jan 18, 2021 at 09:34 AM
Raj - Jan 28, 2021 at 10:46 PM
Raj - Jan 28, 2021 at 10:46 PM
Related:
- Excel to base64
- Excel mod apk for pc - Download - Spreadsheets
- Kernel for excel repair - Download - Backup and recovery
- Dash becomes date on excel ✓ - Office Software Forum
- Vat calculation excel - Guide
- Number to words in excel - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Contributor
Last seen
December 27, 2022
555
Jan 28, 2021 at 12:18 PM
Jan 28, 2021 at 12:18 PM
Hi Raj,
I'm not familiar with Base64. I did find this code on the world wide web:
Place the code in a standard module. In excel use it as any other function: =EncodeFile(cell reference with the entire path of the picture)
Best regards,
Trowa
I'm not familiar with Base64. I did find this code on the world wide web:
Public Function EncodeFile(strPicPath As String) As String
Const adTypeBinary = 1 ' Binary file is encoded
' Variables for encoding
Dim objXML
Dim objDocElem
' Variable for reading binary picture
Dim objStream
' Open data stream from picture
Set objStream = CreateObject("ADODB.Stream")
objStream.Type = adTypeBinary
objStream.Open
objStream.LoadFromFile (strPicPath)
' Create XML Document object and root node
' that will contain the data
Set objXML = CreateObject("MSXml2.DOMDocument")
Set objDocElem = objXML.createElement("Base64Data")
objDocElem.dataType = "bin.base64"
' Set binary value
objDocElem.nodeTypedValue = objStream.Read()
' Get base64 value
EncodeFile = objDocElem.Text
' Clean all
Set objXML = Nothing
Set objDocElem = Nothing
Set objStream = Nothing
End Function
Place the code in a standard module. In excel use it as any other function: =EncodeFile(cell reference with the entire path of the picture)
Best regards,
Trowa

Jan 28, 2021 at 10:46 PM
Appreciated.
Regards,
Raj