I am using the code below to open the file picker and grab an object. I can then translate the object into Base64 and write it out into an XML file without importing and saving the object. However, in certain cases I already have the path stored in the database and would like to use that path instead of opening the file picker.
is there a way to substitute the path "c:\files\myPDF.pdf" for "fd.SelectedItems(1)" and grab that object without opening the file picker? My goal is to avoid importing the object into a table, but just grab the object and translate it to Base64 then write it out into an XML file.
_______________________________________
Private Sub cmbAddBinaryData_Click()
FilePickerControl = False
'Open the File Picker control
Set fd = Application.FileDialog(msoFileDialogFilePicker)
fd.AllowMultiSelect = False
If fd.Show = -1 Then
txtfiletoupload = fd.SelectedItems(1)
End If
Open txtfiletoupload For Binary Access Read As #1
ReDim ByteImage(1 To LOF(1))
Get #1, , ByteImage
Close #1
strData = EncodeBase64(ByteImage)
Me.txtAttBinaryDataPath = txtfiletoupload
FilePickerControl = True