ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Retrieving Excel File extension based on XL File Format Enumeratio (https://www.excelbanter.com/excel-programming/430253-retrieving-excel-file-extension-based-xl-file-format-enumeratio.html)

Sasikumar Kannappan

Retrieving Excel File extension based on XL File Format Enumeratio
 

Hi,
Am actually trying to find the extension of a file with the XL File Format
Enumeration as the input. For example, the XL File Format Enumeration for
".csv" file is 6, so if I give the input as 6, the output should be ".csv".

Is there a way to do this?

Thanks in advance.

Peter T

Retrieving Excel File extension based on XL File Format Enumeratio
 

AFAIK there is no direct way to return the default file extensions
associated with a given file format.

Typically you won't be working with many of them so why not hard code them
against a lookup table, or even simply

Select Case myFileFormat
case xlCSV: sExt = ".csv"
case xlWorkbookNormal, 56: sExt = ".xls"
case 51: sExt = ".xlsx"
' etc
end Select

Regards,
Peter T

"Sasikumar Kannappan" wrote
in message ...
Hi,
Am actually trying to find the extension of a file with the XL File Format
Enumeration as the input. For example, the XL File Format Enumeration for
".csv" file is 6, so if I give the input as 6, the output should be
".csv".

Is there a way to do this?

Thanks in advance.




Sasikumar Kannappan

Retrieving Excel File extension based on XL File Format Enumer
 

Thanks for the response Peter. That's the solution am using right now, wanted
to check if there's anything else available :)

"Peter T" wrote:

AFAIK there is no direct way to return the default file extensions
associated with a given file format.

Typically you won't be working with many of them so why not hard code them
against a lookup table, or even simply

Select Case myFileFormat
case xlCSV: sExt = ".csv"
case xlWorkbookNormal, 56: sExt = ".xls"
case 51: sExt = ".xlsx"
' etc
end Select

Regards,
Peter T

"Sasikumar Kannappan" wrote
in message ...
Hi,
Am actually trying to find the extension of a file with the XL File Format
Enumeration as the input. For example, the XL File Format Enumeration for
".csv" file is 6, so if I give the input as 6, the output should be
".csv".

Is there a way to do this?

Thanks in advance.






All times are GMT +1. The time now is 07:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com