Error in .SelectedItems during File Picking [Closed]

Report
Posts
6
Registration date
Monday October 24, 2016
Status
Member
Last seen
November 24, 2016
-
Posts
14452
Registration date
Sunday June 8, 2008
Status
Contributor
Last seen
March 4, 2021
-
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

1 reply

Posts
14452
Registration date
Sunday June 8, 2008
Status
Contributor
Last seen
March 4, 2021
4
On which line do you get "Runtime Error 450"?

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!