Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do i save a image to the same folder my .xls file is located?
I want to allow the user to tell me where a file(.pdf, .tif,.gif, .doc, etc)
is located. After that I want the progrem to verfy the file exist, then save a new copy to the same path as my .xls docment and under a new name. Can you Help? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do i save a image to the same folder my .xls file is located?
How about letting the user choose the file. Then you know that it exists.
Option Explicit Sub testme() Dim myFileName As Variant Dim JustFileName As String Dim NewPath As String myFileName = Application.GetOpenFilename(filefilter:="All Files, *.*") If myFileName = False Then 'user hit cancel Exit Sub End If JustFileName = Mid(myFileName, InStrRev(myFileName, "\") + 1) NewPath = ThisWorkbook.Path 'activeworkbook.path???? FileCopy Source:=myFileName, _ Destination:=NewPath & "\" & JustFileName End Sub Mr. GetRight wrote: I want to allow the user to tell me where a file(.pdf, .tif,.gif, .doc, etc) is located. After that I want the progrem to verfy the file exist, then save a new copy to the same path as my .xls docment and under a new name. Can you Help? -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do i save a image to the same folder my .xls file is locat
Works Perfectly! Thanks a Million!
"Dave Peterson" wrote: How about letting the user choose the file. Then you know that it exists. Option Explicit Sub testme() Dim myFileName As Variant Dim JustFileName As String Dim NewPath As String myFileName = Application.GetOpenFilename(filefilter:="All Files, *.*") If myFileName = False Then 'user hit cancel Exit Sub End If JustFileName = Mid(myFileName, InStrRev(myFileName, "\") + 1) NewPath = ThisWorkbook.Path 'activeworkbook.path???? FileCopy Source:=myFileName, _ Destination:=NewPath & "\" & JustFileName End Sub Mr. GetRight wrote: I want to allow the user to tell me where a file(.pdf, .tif,.gif, .doc, etc) is located. After that I want the progrem to verfy the file exist, then save a new copy to the same path as my .xls docment and under a new name. Can you Help? -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Save file in a new folder, but create folder only if folder doesn't already exist? | Excel Programming | |||
Need code to save file to new folder, erase from old folder | Excel Discussion (Misc queries) | |||
open file from folder save in new folder | Excel Programming | |||
How to save a bar chart as an image file programmatically? | Excel Programming | |||
Save an image from a worksheet to a file | Excel Programming |