Copying Images to Folder Location

Abbos

Registered User.
Local time
Today, 11:56
Joined
May 11, 2005
Messages
64
Hi there,

I have a form which allows a user to click a button, select a image file and it then references that path instead of embedding it. At the same time I would like to write some code that will copy the image from wherever it is located and copy it into the application path\images folder.

Can anyone help?
 
FileCopy "Drive:\path\file.name", "Drive:\Path\file.name"
 
Thanks FoFa,

I am using variables in my case and am having problems as the variable returns the full path of the image location:

Code:
FileCopy OpenFile.lpstrFile, Location

Location = Path & OpenFile.lpstrFile
Path = "C:\Database\

At the moment OpenFile.lpstrFile is returning for example "C:\Windows\Start.bmp" so the completed result of Location is becoming "C:\Database\C:\Windows\Start.bmp"

How can I trim down the returned result when selecting the file so that it will only keep the Start.bmp part?

Thanks,
 
Ok, I have got a little further but now stuck again with a Type Mismatch error.

Here is my code:

Code:
LaunchCD = Trim(Left(OpenFile.lpstrFile, InStr(1, OpenFile.lpstrFile, vbNullChar) - 1))
sParts = Split(LaunchCD, "\")

LaunchCD and sParts are declared as Strings.

Any ideas?
 

Users who are viewing this thread

Back
Top Bottom