With the following function (source) can I load and then encode to base64 an image. Now I would like to resize the image (keeping width/height ratio) before encoding it. I'm not used to program in Vba and I did not find any example or snippet that may help me.
Public Function EncodeFileBase64(strPicPath As String) As String
Const adTypeBinary = 1
Dim objXML
Dim objDocElem
Dim objStream
Set objStream = CreateObject("ADODB.Stream")
objStream.Type = adTypeBinary
objStream.Open
objStream.LoadFromFile (strPicPath)
Set objXML = CreateObject("MSXml2.DOMDocument")
Set objDocElem = objXML.CreateElement("Base64Data")
objDocElem.DataType = "bin.base64"
objDocElem.nodeTypedValue = objStream.Read()
' EncodeFileBase64 = objDocElem.Text
EncodeFileBase64 = Replace(objDocElem.Text, vbLf, "")
Set objXML = Nothing
Set objDocElem = Nothing
Set objStream = Nothing
End Function