• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Macro to browse image/picture files

Dee

Member
Hi Guys,


I am using the below code to search for an excel file.Can any one of you suggest the code to get the image/picture files (jpeg,jpg,bmp files for example)in the similar pattern?


Flatfilename = Application.GetOpenFilename(FileFilter:="Excel files (*.xls), *.xls",

Title:="Please choose a file")


Thanking you in advance,

Dee
 
do you mean like


Flatfilename = Application.GetOpenFilename(FileFilter:="Pic Files (*.jpg, *.JPEG, *.Bmp), *.jpg, *.JPEG, *.bmp")
 
HI HUI,

Thank you very much for your quick reply.This is exactly what i was looking for.

Basically i was trying to browse for the picture files to copy and paste it to the excel file.

Can you please help me with some smart code for the same?


Thanking you in advance,

Dee
 
I think it should be

filetoopen = Application.GetOpenFilename("Pic Files (*.jpg), *.jpg ,Jpeg Files (*.jpeg), *.jpeg,Bitmap Files (*.bmp), *.bmp")
 
I'm not sure how much more complex than this you want

[pre]
Code:
Sub InsertPic()

filetoopen = Application.GetOpenFilename("Pic Files (*.jpg), *.jpg ,Jpeg Files (*.jpeg), *.jpeg,Bitmap Files (*.bmp), *.bmp")
ActiveSheet.Pictures.Insert(filetoopen).Select
End Sub
[/pre]
 
Back
Top