Error in .SelectedItems during File Picking

Closed
adikademani Posts 5 Registration date Monday October 24, 2016 Status Member Last seen November 24, 2016 - Nov 14, 2016 at 04:02 AM
yg_be Posts 23408 Registration date Sunday June 8, 2008 Status Contributor Last seen December 26, 2024 - Nov 15, 2016 at 04:29 PM
Hello Guys,

I am trying to save a file path in a variable using .SelectedItems but the code is showing "Runtime Error 450". Kindly help me by rectifying the mistake in the code. Thanks in Advance :)

Sub pickafile()

Dim x As FileDialog
Dim y As Variant

Set x = Application.FileDialog(msoFileDialogFilePicker)

x.Filters.Add "Images", "*.jpg,*.jpeg"
x.Show

y = x.SelectedItems

ActiveSheet.Pictures.Insert(y).Select


End Sub
Related:

1 response

yg_be Posts 23408 Registration date Sunday June 8, 2008 Status Contributor Last seen December 26, 2024 5
Nov 15, 2016 at 04:29 PM
On which line do you get "Runtime Error 450"?
0