ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel File format List (https://www.excelbanter.com/excel-programming/279938-excel-file-format-list.html)

Douglas Lund

Excel File format List
 
I'm coding export functionality into my VB6 app, which incorporates an
excel file export, for which I use the Microsoft Excel 9.0 object
library. I would like to display the excel file formats available to
the user in a combo box.

How can I get a list of available formats at runtime ?

Iain Sheetware

Excel File format List
 
Douglas

Try this function:

'returns an array of strings containing descriptions of the possible save as options
Private Function AllSaveAsOptions() As Variant

Dim ret_val() As String
Dim fdfs As FileDialogFilters
Dim this_fdf As Long

'Set the FileDialogFilters collection variable to
'the FileDialogFilters collection of the SaveAs dialog box.
Set fdfs = Application.FileDialog(msoFileDialogSaveAs).Filter s

'make the array big enough
ReDim ret_val(fdfs.Count)

'Iterate through the description and extensions of each
'default filter in the SaveAs dialog box.
For this_fdf = 1 To fdfs.Count
ret_val(this_fdf) = fdfs.Item(this_fdf).Description
Next fdf

'and return the array
AllSaveAsOptions = ret_val
End Function

Hope that helps.

Iain


(Douglas Lund) wrote in message om...
I'm coding export functionality into my VB6 app, which incorporates an
excel file export, for which I use the Microsoft Excel 9.0 object
library. I would like to display the excel file formats available to
the user in a combo box.

How can I get a list of available formats at runtime ?


Iain Sheetware

Excel File format List
 
Douglas

Try this function:

'returns an array of strings containing descriptions of the possible save as options
Private Function AllSaveAsOptions() As Variant

Dim ret_val() As String
Dim fdfs As FileDialogFilters
Dim this_fdf As Long

'Set the FileDialogFilters collection variable to
'the FileDialogFilters collection of the SaveAs dialog box.
Set fdfs = Application.FileDialog(msoFileDialogSaveAs).Filter s

'make the array big enough
ReDim ret_val(fdfs.Count)

'Iterate through the description and extensions of each
'default filter in the SaveAs dialog box.
For this_fdf = 1 To fdfs.Count
ret_val(this_fdf) = fdfs.Item(this_fdf).Description
Next fdf

'and return the array
AllSaveAsOptions = ret_val
End Function

Hope that helps.

Iain


(Douglas Lund) wrote in message om...
I'm coding export functionality into my VB6 app, which incorporates an
excel file export, for which I use the Microsoft Excel 9.0 object
library. I would like to display the excel file formats available to
the user in a combo box.

How can I get a list of available formats at runtime ?


Tom Ogilvy

Excel File format List
 
OP said: Microsoft Excel 9.0 object

Which is Excel 2000.

I believe Iain's solution would only work in xl2002 and later.



--
Regards,
Tom Ogilvy

Iain Sheetware wrote in message
om...
Douglas

Try this function:

'returns an array of strings containing descriptions of the possible save

as options
Private Function AllSaveAsOptions() As Variant

Dim ret_val() As String
Dim fdfs As FileDialogFilters
Dim this_fdf As Long

'Set the FileDialogFilters collection variable to
'the FileDialogFilters collection of the SaveAs dialog box.
Set fdfs = Application.FileDialog(msoFileDialogSaveAs).Filter s

'make the array big enough
ReDim ret_val(fdfs.Count)

'Iterate through the description and extensions of each
'default filter in the SaveAs dialog box.
For this_fdf = 1 To fdfs.Count
ret_val(this_fdf) = fdfs.Item(this_fdf).Description
Next fdf

'and return the array
AllSaveAsOptions = ret_val
End Function

Hope that helps.

Iain


(Douglas Lund) wrote in message

om...
I'm coding export functionality into my VB6 app, which incorporates an
excel file export, for which I use the Microsoft Excel 9.0 object
library. I would like to display the excel file formats available to
the user in a combo box.

How can I get a list of available formats at runtime ?




Douglas Lund

Excel File format List
 
OK, Thanks Tom.
Is there any way to do it using Excel 2000 object ?
If not, am I able to redistribute the Excel 2002 object to clients
without Excel 2002?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 11:59 AM.

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