I need to import PDF and XLS objects and convert them to binary. The following code doesn't work, apparently because the "fd.SelectedItems(1)" is the path of the object instead of the object itself.
If I dim "fileToUpload" as an object, I get a "run time '91' Object variable or With block variable not set".
If I don't specifically Dim "fileToUpload", when I get to the last line below I get "run time '424' Object required".
Anyone know the magic words?
Dim fd As FileDialog
Dim ImageToBytes() As Byte
Dim ImageCode As String
FilePickerControl = False
Set fd = Application.FileDialog(msoFileDialogFilePicker)
fd.AllowMultiSelect = False
If fd.Show = -1 Then
FileToUpload = fd.SelectedItems(1)
End If
ImageToBytes = System.IO.File.ReadAllBytes(FileToUpload)