I have a spreadsheet that produces an image in the clipboard, and need some help to get this over the finish line.
The sub I have opens a dialog box, and I just need to be able to write the clipboard image to whatever filename the user takes. Here is the code:
Sub openDialog()
Dim fd As Office.FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.AllowMultiSelect = False
' Set the title of the dialog box.
.Title = "Please select the file."
' Clear out the current filters, and add our own.
.Filters.Clear
.Filters.Add "JPEG File Interchange Format", "*.jpg"
.Filters.Add "All Files", "*.*"
' Show the dialog box. If the .Show method returns True, the
' user picked at least one file. If the .Show method returns
' False, the user clicked Cancel.
If .Show = True Then
txtFileName = .SelectedItems(1) 'replace txtFileName with your textbox
End If
End With
End Sub
Any help would be appreciated.
I have tried to look at existing Stack Overflow articles that appear somewhat similar but don’t work.
user25351031 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.