PC Review


Reply
Thread Tools Rate Thread

BROWSE AN IMAGE from hardisk an past to excel

 
 
Disperso
Guest
Posts: n/a
 
      2nd Sep 2004
my .xls must be simply a foto and a button "browse".
I want that i can browse a photo from hardisk and, when i selected, it
appear
on document.

Can you help me?

thx


 
Reply With Quote
 
 
 
 
Ron de Bruin
Guest
Posts: n/a
 
      2nd Sep 2004
Try this Disperso

MyPath = "C:\"
Change this to your path


Sub test()
Dim FName As Variant
Dim wb As Workbook
Dim MyPath As String
Dim SaveDriveDir As String

SaveDriveDir = CurDir

MyPath = "C:\"
ChDrive MyPath
ChDir MyPath

FName = Application.GetOpenFilename(filefilter:= _
"Pictures(*.jpg;*.gif;*.bmp), *.jpg;*.gif;*.bmp")

If FName <> False Then
ActiveSheet.Shapes.AddPicture FName, msoTrue, _
msoFalse, 100, 100, 100, 50
End If

ChDrive SaveDriveDir
ChDir SaveDriveDir

End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Disperso" <(E-Mail Removed)> wrote in message news:hbHZc.2450$(E-Mail Removed)...
> my .xls must be simply a foto and a button "browse".
> I want that i can browse a photo from hardisk and, when i selected, it
> appear
> on document.
>
> Can you help me?
>
> thx
>
>



 
Reply With Quote
 
Disperso
Guest
Posts: n/a
 
      3rd Sep 2004
wow it function!

before thanking you, if possibile i want to add a variant:

i click a button for browse a file on mypath1.
the file that i've select will be writed, without extension, on a cell (only
the name of file) (now i call it %file%)
At same time, will be automatically paste an image from mypath2 (another
custom path) %file%.jpg
and another image from mypath3 V2_%file%.jpg
Example of result is this:
i'm browsing a file called "foto1.kkk";
after selected, the name "foto1" appear on a cell and will be loaded an
image foto1.jpg (from mypath2) and V2_foto1.jpg
from mypath3

Excuse for this request, I am note studying Excel

thank you very much

"Ron de Bruin" <(E-Mail Removed)> ha scritto nel messaggio
news:(E-Mail Removed)...
> Try this Disperso
>
> MyPath = "C:\"
> Change this to your path
>
>
> Sub test()
> Dim FName As Variant
> Dim wb As Workbook
> Dim MyPath As String
> Dim SaveDriveDir As String
>
> SaveDriveDir = CurDir
>
> MyPath = "C:\"
> ChDrive MyPath
> ChDir MyPath
>
> FName = Application.GetOpenFilename(filefilter:= _
>

"Pictures(*.jpg;*.gif;*.bmp), *.jpg;*.gif;*.bmp")
>
> If FName <> False Then
> ActiveSheet.Shapes.AddPicture FName, msoTrue, _
> msoFalse, 100, 100, 100, 50
> End If
>
> ChDrive SaveDriveDir
> ChDir SaveDriveDir
>
> End Sub
>
>
> --
> Regards Ron de Bruin
> http://www.rondebruin.nl
>
>
> "Disperso" <(E-Mail Removed)> wrote in message

news:hbHZc.2450$(E-Mail Removed)...
> > my .xls must be simply a foto and a button "browse".
> > I want that i can browse a photo from hardisk and, when i selected, it
> > appear
> > on document.
> >
> > Can you help me?
> >
> > thx
> >
> >

>
>



 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      3rd Sep 2004
You can use this to get only the file name

Dim filename As String
filename = Left(Dir(FName), Len(Dir(FName)) - 4)
MsgBox filename


You can use filename in your other code then

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Disperso" <(E-Mail Removed)> wrote in message news:P7XZc.2575$(E-Mail Removed)...
> wow it function!
>
> before thanking you, if possibile i want to add a variant:
>
> i click a button for browse a file on mypath1.
> the file that i've select will be writed, without extension, on a cell (only
> the name of file) (now i call it %file%)
> At same time, will be automatically paste an image from mypath2 (another
> custom path) %file%.jpg
> and another image from mypath3 V2_%file%.jpg
> Example of result is this:
> i'm browsing a file called "foto1.kkk";
> after selected, the name "foto1" appear on a cell and will be loaded an
> image foto1.jpg (from mypath2) and V2_foto1.jpg
> from mypath3
>
> Excuse for this request, I am note studying Excel
>
> thank you very much
>
> "Ron de Bruin" <(E-Mail Removed)> ha scritto nel messaggio
> news:(E-Mail Removed)...
>> Try this Disperso
>>
>> MyPath = "C:\"
>> Change this to your path
>>
>>
>> Sub test()
>> Dim FName As Variant
>> Dim wb As Workbook
>> Dim MyPath As String
>> Dim SaveDriveDir As String
>>
>> SaveDriveDir = CurDir
>>
>> MyPath = "C:\"
>> ChDrive MyPath
>> ChDir MyPath
>>
>> FName = Application.GetOpenFilename(filefilter:= _
>>

> "Pictures(*.jpg;*.gif;*.bmp), *.jpg;*.gif;*.bmp")
>>
>> If FName <> False Then
>> ActiveSheet.Shapes.AddPicture FName, msoTrue, _
>> msoFalse, 100, 100, 100, 50
>> End If
>>
>> ChDrive SaveDriveDir
>> ChDir SaveDriveDir
>>
>> End Sub
>>
>>
>> --
>> Regards Ron de Bruin
>> http://www.rondebruin.nl
>>
>>
>> "Disperso" <(E-Mail Removed)> wrote in message

> news:hbHZc.2450$(E-Mail Removed)...
>> > my .xls must be simply a foto and a button "browse".
>> > I want that i can browse a photo from hardisk and, when i selected, it
>> > appear
>> > on document.
>> >
>> > Can you help me?
>> >
>> > thx
>> >
>> >

>>
>>

>
>



 
Reply With Quote
 
Disperso
Guest
Posts: n/a
 
      3rd Sep 2004
unfortunately
the extension not always are 3 character; in this case?

"Ron de Bruin" <(E-Mail Removed)> ha scritto nel messaggio
news:(E-Mail Removed)...
> You can use this to get only the file name
>
> Dim filename As String
> filename = Left(Dir(FName), Len(Dir(FName)) - 4)
> MsgBox filename
>
>
> You can use filename in your other code then
>
> --
> Regards Ron de Bruin
> http://www.rondebruin.nl
>
>
> "Disperso" <(E-Mail Removed)> wrote in message

news:P7XZc.2575$(E-Mail Removed)...
> > wow it function!
> >
> > before thanking you, if possibile i want to add a variant:
> >
> > i click a button for browse a file on mypath1.
> > the file that i've select will be writed, without extension, on a cell

(only
> > the name of file) (now i call it %file%)
> > At same time, will be automatically paste an image from mypath2 (another
> > custom path) %file%.jpg
> > and another image from mypath3 V2_%file%.jpg
> > Example of result is this:
> > i'm browsing a file called "foto1.kkk";
> > after selected, the name "foto1" appear on a cell and will be loaded an
> > image foto1.jpg (from mypath2) and V2_foto1.jpg
> > from mypath3
> >
> > Excuse for this request, I am note studying Excel
> >
> > thank you very much
> >
> > "Ron de Bruin" <(E-Mail Removed)> ha scritto nel messaggio
> > news:(E-Mail Removed)...
> >> Try this Disperso
> >>
> >> MyPath = "C:\"
> >> Change this to your path
> >>
> >>
> >> Sub test()
> >> Dim FName As Variant
> >> Dim wb As Workbook
> >> Dim MyPath As String
> >> Dim SaveDriveDir As String
> >>
> >> SaveDriveDir = CurDir
> >>
> >> MyPath = "C:\"
> >> ChDrive MyPath
> >> ChDir MyPath
> >>
> >> FName = Application.GetOpenFilename(filefilter:= _
> >>

> > "Pictures(*.jpg;*.gif;*.bmp), *.jpg;*.gif;*.bmp")
> >>
> >> If FName <> False Then
> >> ActiveSheet.Shapes.AddPicture FName, msoTrue, _
> >> msoFalse, 100, 100, 100, 50
> >> End If
> >>
> >> ChDrive SaveDriveDir
> >> ChDir SaveDriveDir
> >>
> >> End Sub
> >>
> >>
> >> --
> >> Regards Ron de Bruin
> >> http://www.rondebruin.nl
> >>
> >>
> >> "Disperso" <(E-Mail Removed)> wrote in message

> > news:hbHZc.2450$(E-Mail Removed)...
> >> > my .xls must be simply a foto and a button "browse".
> >> > I want that i can browse a photo from hardisk and, when i selected,

it
> >> > appear
> >> > on document.
> >> >
> >> > Can you help me?
> >> >
> >> > thx
> >> >
> >> >
> >>
> >>

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy and past an image Bill Microsoft Word Document Management 5 6th May 2010 01:41 PM
Excel - Browse for new Image Control picture via macro RDavey Windows XP 0 26th Jun 2008 07:45 PM
How to Past an Image from Excel 2000 into MS Outlook 2000 =?Utf-8?B?RXhjZWxHLkkuVA==?= Microsoft Excel Programming 3 29th Nov 2005 06:49 PM
can i get back overwriting excel from my hardisk =?Utf-8?B?ZmFpemFs?= Microsoft Excel Misc 1 8th Jul 2005 09:47 AM
How To Browse for an image file and save it to image server folder Mike John Microsoft ASP .NET 0 28th Jul 2003 05:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:09 PM.