D
Disperso
hi
i've this macro string for write a filename (that i select) in a cell
without the extension.
In this case the filename remove only the 3 letters of extension. I need a
macro that
remove more long extension (filename.
how i can modify this?
Sub test()
Dim FName As Variant
Dim wb As Workbook
Dim MyPath As String
Dim SaveDriveDir As String
Dim filename 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
filename = Left(Dir(FName), Len(Dir(FName)) - 4)
MsgBox filename
End If
ChDrive SaveDriveDir
ChDir SaveDriveDir
End Sub
(thanks Rob)
i've this macro string for write a filename (that i select) in a cell
without the extension.
In this case the filename remove only the 3 letters of extension. I need a
macro that
remove more long extension (filename.
how i can modify this?
Sub test()
Dim FName As Variant
Dim wb As Workbook
Dim MyPath As String
Dim SaveDriveDir As String
Dim filename 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
filename = Left(Dir(FName), Len(Dir(FName)) - 4)
MsgBox filename
End If
ChDrive SaveDriveDir
ChDir SaveDriveDir
End Sub
(thanks Rob)