Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
John,
As long as you are using pictures from the same folder, you can do something like this: the first one inserts the file, the second one tells you its name (though it must be selected) Dim myName As String Dim myPicName As String Const myPath As String = "C:\Documents and Settings\DEITBE\My Documents\My Pictures\" Sub InsertPicture() myName = "0ead1e14.jpg" ActiveSheet.Pictures.Insert(myPath & myName).Select 'get rid of spaces and periods, illegal characters in picture names myPicName = Replace(Replace(myName, ".", "xxx"), " ", "qqq") MsgBox myPicName End Sub Sub WhatFileNameIsPicture() Selection.Name = myPicName MsgBox myPath & Replace(Replace(Selection.Name, "qxq", "\"), "xxx", ".") End Sub HTH, Bernie MS Excel MVP "john" wrote in message ... I used the following code to insert a picture into a xls file. ActiveSheet.Pictures.Insert("C:\Documents and Settings\Administrator\My Documents\My Pictures\0ead1e14.jpg") But I want to get this inserted picture's original filename days later. And I want to export this inserted picture to a picture file by VBA code, not by copying and pasting. Can I do it by VBA code. I use the Name property of the inserted picture. But The property return "Picture 1" to me. How can I get the original filename and export it by VBA code. Best Regards John Black |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Cell("filename") doesn't update to new filename when do save as. | Excel Worksheet Functions | |||
set filename to <filename-date on open | Excel Worksheet Functions | |||
Auto save replaced my original file and now I need the original? | Excel Discussion (Misc queries) | |||
Inserted Pictures Do Appear | Excel Discussion (Misc queries) | |||
Saving filename same as import filename | Excel Programming |