View Single Post
 
Old 11-15-2014, 01:08 AM
gmayor's Avatar
gmayor gmayor is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,142
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Greg should be sleeping at the moment, but looking at his code I suspect the following should work, though I haven't tested it.

You will need a function to get the original extension and add that instead of .png

e.g.

Code:
Name strBasePath & strExtractionFolder & "_files\" & _
             strName As strBasePath & strExtractionFolder & "_files\" & _
             strImageName & GetExtension(strfname)
The function would be
Code:
Function GetExtension(ByRef StrFilename As String) As String
    GetExtension = VBA.Right(StrFilename, Len(StrFilename) - InStrRev(StrFilename, Chr(46)) + 1)
lbl_Exit:
    Exit Function
Err_NoExtension:
    GetExtension = vbNullString
    Resume lbl_Exit
End Function
Greg is a good friend who I work with a lot so I have used his vba formatting style, to match the other processes.

You can get rid of the SpecialFolderPath function as your modified version of the code doesn't call it. In any case it is not a good idea to save to the Desktop. That is a special type of folder and some write functions from VBA may not work as expected when it is used.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote