View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Mr. GetRight[_2_] Mr. GetRight[_2_] is offline
external usenet poster
 
Posts: 11
Default 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