Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default macro to locate picture

Want to crteate a macro that goes to exploerer and allows me to choose any
photo by clicking on it. Not a specific photo but different ones each time I
run the macro.
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default macro to locate picture

Use the GetOpenFileName which Displays the standard Open dialog box and gets
a file name from the user without actually opening any files. Change .txt to
the picture extension you are using such as .jpg


fileToOpen = Application _
.GetOpenFilename("Text Files (*.txt), *.txt")
If fileToOpen < False Then
MsgBox "Open " & fileToOpen
End If


"gwbdirect" wrote:

Want to crteate a macro that goes to exploerer and allows me to choose any
photo by clicking on it. Not a specific photo but different ones each time I
run the macro.
Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default macro to locate picture



"Joel" wrote:

Use the GetOpenFileName which Displays the standard Open dialog box and gets
a file name from the user without actually opening any files. Change .txt to
the picture extension you are using such as .jpg


fileToOpen = Application _
.GetOpenFilename("Text Files (*.txt), *.txt")
If fileToOpen < False Then
MsgBox "Open " & fileToOpen
End If


"gwbdirect" wrote:

Want to crteate a macro that goes to exploerer and allows me to choose any
photo by clicking on it. Not a specific photo but different ones each time I
run the macro.
Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default macro to locate picture

Hi Joel,
Thanks for the code.
I want to chenge to photo extensions so how do i write it
.GetOpenFilename (*.jpeg), *.jpeg")
This doesn't work so can you write it properly.
Thanks again


"Joel" wrote:

Use the GetOpenFileName which Displays the standard Open dialog box and gets
a file name from the user without actually opening any files. Change .txt to
the picture extension you are using such as .jpg


fileToOpen = Application _
.GetOpenFilename("Text Files (*.txt), *.txt")
If fileToOpen < False Then
MsgBox "Open " & fileToOpen
End If


"gwbdirect" wrote:

Want to crteate a macro that goes to exploerer and allows me to choose any
photo by clicking on it. Not a specific photo but different ones each time I
run the macro.
Thanks

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default macro to locate picture


fileToOpen = Application _
.GetOpenFilename("All Files (*.jpg),*.jpg")

"gwbdirect" wrote:

Hi Joel,
Thanks for the code.
I want to chenge to photo extensions so how do i write it
.GetOpenFilename (*.jpeg), *.jpeg")
This doesn't work so can you write it properly.
Thanks again


"Joel" wrote:

Use the GetOpenFileName which Displays the standard Open dialog box and gets
a file name from the user without actually opening any files. Change .txt to
the picture extension you are using such as .jpg


fileToOpen = Application _
.GetOpenFilename("Text Files (*.txt), *.txt")
If fileToOpen < False Then
MsgBox "Open " & fileToOpen
End If


"gwbdirect" wrote:

Want to crteate a macro that goes to exploerer and allows me to choose any
photo by clicking on it. Not a specific photo but different ones each time I
run the macro.
Thanks



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default macro to locate picture

Iwas able to make the macro go find picture files in my picture folder. Now I
need to figure out a code that would allow me to copy and paste chosen
pictures either 1 at a time or multiple at a time and put them on my
workshhet.
Tanks for all your help. I'll send in another question if I can't figure it
out.

"Joel" wrote:


fileToOpen = Application _
.GetOpenFilename("All Files (*.jpg),*.jpg")

"gwbdirect" wrote:

Hi Joel,
Thanks for the code.
I want to chenge to photo extensions so how do i write it
.GetOpenFilename (*.jpeg), *.jpeg")
This doesn't work so can you write it properly.
Thanks again


"Joel" wrote:

Use the GetOpenFileName which Displays the standard Open dialog box and gets
a file name from the user without actually opening any files. Change .txt to
the picture extension you are using such as .jpg


fileToOpen = Application _
.GetOpenFilename("Text Files (*.txt), *.txt")
If fileToOpen < False Then
MsgBox "Open " & fileToOpen
End If


"gwbdirect" wrote:

Want to crteate a macro that goes to exploerer and allows me to choose any
photo by clicking on it. Not a specific photo but different ones each time I
run the macro.
Thanks

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default macro to locate picture

To add the picture use statement below. You can replace the hard-coded file
name with the file name return from the GetOpenFileName



Range("N16").Select
ActiveSheet.Pictures.Insert("H:\My Documents\My
Pictures\JTAG-Board.jpg"). _
Select

or

Range("N16").Select
ActiveSheet.Pictures.Insert(filetoOpen).Select

"gwbdirect" wrote:

Iwas able to make the macro go find picture files in my picture folder. Now I
need to figure out a code that would allow me to copy and paste chosen
pictures either 1 at a time or multiple at a time and put them on my
workshhet.
Tanks for all your help. I'll send in another question if I can't figure it
out.

"Joel" wrote:


fileToOpen = Application _
.GetOpenFilename("All Files (*.jpg),*.jpg")

"gwbdirect" wrote:

Hi Joel,
Thanks for the code.
I want to chenge to photo extensions so how do i write it
.GetOpenFilename (*.jpeg), *.jpeg")
This doesn't work so can you write it properly.
Thanks again


"Joel" wrote:

Use the GetOpenFileName which Displays the standard Open dialog box and gets
a file name from the user without actually opening any files. Change .txt to
the picture extension you are using such as .jpg


fileToOpen = Application _
.GetOpenFilename("Text Files (*.txt), *.txt")
If fileToOpen < False Then
MsgBox "Open " & fileToOpen
End If


"gwbdirect" wrote:

Want to crteate a macro that goes to exploerer and allows me to choose any
photo by clicking on it. Not a specific photo but different ones each time I
run the macro.
Thanks

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default macro to locate picture

Joel,
What if you want ALL graphic files to show, e.g., .jpg, .gif, .bmp, .png?
How would the code be written?
Thanx.

"Joel" wrote:


fileToOpen = Application _
.GetOpenFilename("All Files (*.jpg),*.jpg")

"gwbdirect" wrote:

Hi Joel,
Thanks for the code.
I want to chenge to photo extensions so how do i write it
.GetOpenFilename (*.jpeg), *.jpeg")
This doesn't work so can you write it properly.
Thanks again


"Joel" wrote:

Use the GetOpenFileName which Displays the standard Open dialog box and gets
a file name from the user without actually opening any files. Change .txt to
the picture extension you are using such as .jpg


fileToOpen = Application _
.GetOpenFilename("Text Files (*.txt), *.txt")
If fileToOpen < False Then
MsgBox "Open " & fileToOpen
End If


"gwbdirect" wrote:

Want to crteate a macro that goes to exploerer and allows me to choose any
photo by clicking on it. Not a specific photo but different ones each time I
run the macro.
Thanks

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default macro to locate picture

fileToOpen = Application.GetOpenFilename( _
"All Graphic Files (*.jpg; *.gif; *.bmp; *.png),*.jpg;*.gif;*.bmp;*.png")

The fields are seperated with semicolons.

"Rhino V" wrote:

Joel,
What if you want ALL graphic files to show, e.g., .jpg, .gif, .bmp, .png?
How would the code be written?
Thanx.

"Joel" wrote:


fileToOpen = Application _
.GetOpenFilename("All Files (*.jpg),*.jpg")

"gwbdirect" wrote:

Hi Joel,
Thanks for the code.
I want to chenge to photo extensions so how do i write it
.GetOpenFilename (*.jpeg), *.jpeg")
This doesn't work so can you write it properly.
Thanks again


"Joel" wrote:

Use the GetOpenFileName which Displays the standard Open dialog box and gets
a file name from the user without actually opening any files. Change .txt to
the picture extension you are using such as .jpg


fileToOpen = Application _
.GetOpenFilename("Text Files (*.txt), *.txt")
If fileToOpen < False Then
MsgBox "Open " & fileToOpen
End If


"gwbdirect" wrote:

Want to crteate a macro that goes to exploerer and allows me to choose any
photo by clicking on it. Not a specific photo but different ones each time I
run the macro.
Thanks

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default macro to locate picture

Try it this way...

Application.GetOpenFilename ("Graphic Files (*.jpg;*.gif;*.bmp;*.png)," & _
"*.jpg;*.gif;*.bmp;*.png,JPEG Files (*.jpg)," & _
"*.jpg,GIF Files (*.gif),*.gif,BMP Files (*.bmp)," & _
"*.bmp,PNG Files (*.png),*.png,All Files (*.*),*.*")


--
Rick (MVP - Excel)


"Rhino V" wrote in message
...
Joel,
What if you want ALL graphic files to show, e.g., .jpg, .gif, .bmp, .png?
How would the code be written?
Thanx.

"Joel" wrote:


fileToOpen = Application _
.GetOpenFilename("All Files (*.jpg),*.jpg")

"gwbdirect" wrote:

Hi Joel,
Thanks for the code.
I want to chenge to photo extensions so how do i write it
.GetOpenFilename (*.jpeg), *.jpeg")
This doesn't work so can you write it properly.
Thanks again


"Joel" wrote:

Use the GetOpenFileName which Displays the standard Open dialog box
and gets
a file name from the user without actually opening any files. Change
.txt to
the picture extension you are using such as .jpg


fileToOpen = Application _
.GetOpenFilename("Text Files (*.txt), *.txt")
If fileToOpen < False Then
MsgBox "Open " & fileToOpen
End If


"gwbdirect" wrote:

Want to crteate a macro that goes to exploerer and allows me to
choose any
photo by clicking on it. Not a specific photo but different ones
each time I
run the macro.
Thanks




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Locate data macro Malcolm McM[_2_] Excel Discussion (Misc queries) 2 April 26th 10 11:43 PM
Using a macro to locate a user given value Chip Smith Excel Programming 3 August 25th 06 04:15 AM
Locate and Format Row Macro ksp Excel Programming 2 June 12th 06 06:50 AM
locate picture location using macro ME @ Home Excel Programming 5 February 19th 06 07:23 PM
Crrection Help for a macro to locate max value cell twinklejmj[_9_] Excel Programming 2 September 24th 05 04:46 PM


All times are GMT +1. The time now is 02:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"