![]() |
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? |
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 |
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 |
All times are GMT +1. The time now is 09:44 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com