Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
File extension
I am trying to extract the file extension from an excel filepath, in order
to check for .xlsx .xlsm and .xls - for Excel 2003 and 2007. What I would like to do is to have a message box pop up on the sheet "FileExtension" saying something like:- MsgBox "The file extension for this file is " & FileExt This would preferably be in the Worksheet_Activate() procedure. Thanks Sandy |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
File extension
Try this
Dim fileExtension as String Dim splitArray() As String splitArray = Split(ThisWorkbook.name, ".") fileExtension = splitArray(UBound(splitArray)) 3rd line, Splits up a String, using the . character as where to split it so Aworkbook.xls gets split into two. 4th line - assigns the variable fileExtension to the last element in the array, which will be the extension. Hope that makes sense. 2nd line - Split up a String, "Sandy" wrote: I am trying to extract the file extension from an excel filepath, in order to check for .xlsx .xlsm and .xls - for Excel 2003 and 2007. What I would like to do is to have a message box pop up on the sheet "FileExtension" saying something like:- MsgBox "The file extension for this file is " & FileExt This would preferably be in the Worksheet_Activate() procedure. Thanks Sandy |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
File extension
Thank you very much - works perfectly
Sandy "NateBuckley" wrote in message ... Try this Dim fileExtension as String Dim splitArray() As String splitArray = Split(ThisWorkbook.name, ".") fileExtension = splitArray(UBound(splitArray)) 3rd line, Splits up a String, using the . character as where to split it so Aworkbook.xls gets split into two. 4th line - assigns the variable fileExtension to the last element in the array, which will be the extension. Hope that makes sense. 2nd line - Split up a String, "Sandy" wrote: I am trying to extract the file extension from an excel filepath, in order to check for .xlsx .xlsm and .xls - for Excel 2003 and 2007. What I would like to do is to have a message box pop up on the sheet "FileExtension" saying something like:- MsgBox "The file extension for this file is " & FileExt This would preferably be in the Worksheet_Activate() procedure. Thanks Sandy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Display file name without the file type extension | Excel Worksheet Functions | |||
Determine Excel file version with no file extension. | Excel Discussion (Misc queries) | |||
file format or file extension is not valid...error message | Excel Discussion (Misc queries) | |||
Additional file with no extension created during File Save As proc | Excel Discussion (Misc queries) | |||
I need to download an exel spreadsheet file. (file extension :xls) | Excel Discussion (Misc queries) |