Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to use FileConverters?
I am trying to understand how to convert files with Excel automation. I
see the parameter in the open method but I don't know what the possible options are. There is a readonly property Application.FileConverters but I don't know how to do anything with that. I am new to VB so that is part of the problem. VB says the fileconverters is a readonly property fileconverters[index 1 as object], [index 2 as object], as object. What does that mean? Is it a 2 dimensional array? How do I know what the bounds of that are? How can I see what is in each entry? What I am trying to do is open a non-excel file in excel without any user interaction. TIA JO |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to use FileConverters?
workbooks.open Filename:="C:\Myfolder\Myfile.dat"
if Excel can open it, it will. If you can't open it manually by doing File=Open, then you won't be able to do it in VBA (unless you want to read it in binary using low level file io and write code to interpret the elements of the file). The only reason you might want to use the converter property is if Excel tries to open it with the wrong converter. Then you would look at the array returned by application.Fileconverters to determine the row number of the converter you want to use. The converter property tells excel to try that converter first. -- Regards, Tom Ogilvy "Josh Orfanakis" wrote in message ... I am trying to understand how to convert files with Excel automation. I see the parameter in the open method but I don't know what the possible options are. There is a readonly property Application.FileConverters but I don't know how to do anything with that. I am new to VB so that is part of the problem. VB says the fileconverters is a readonly property fileconverters[index 1 as object], [index 2 as object], as object. What does that mean? Is it a 2 dimensional array? How do I know what the bounds of that are? How can I see what is in each entry? What I am trying to do is open a non-excel file in excel without any user interaction. TIA JO |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to use FileConverters?
In article ,
"Tom Ogilvy" wrote: I was thinking along those lines but I would like to enforce a specific converter. In addition I need to avoid any human interaction if possible. So I thought the more I tell it the less it will try and ask me. The problem is I don't know how to investigate the array returned from application.FileConverters. Could you shed some light on that for me? As I mentioned it appears to be multidimensional array, even if it was a single I don't know how to do this in VB. I am actually writing a C++ app but do my prototype in VB. In the TLH file a _variant_t [ ] [ ] [ ] is returned from the GetFileConverters. But that is a hurdle way down the list. First things first. Thank you for your reply. JO workbooks.open Filename:="C:\Myfolder\Myfile.dat" if Excel can open it, it will. If you can't open it manually by doing File=Open, then you won't be able to do it in VBA (unless you want to read it in binary using low level file io and write code to interpret the elements of the file). The only reason you might want to use the converter property is if Excel tries to open it with the wrong converter. Then you would look at the array returned by application.Fileconverters to determine the row number of the converter you want to use. The converter property tells excel to try that converter first. -- Regards, Tom Ogilvy "Josh Orfanakis" wrote in message ... I am trying to understand how to convert files with Excel automation. I see the parameter in the open method but I don't know what the possible options are. There is a readonly property Application.FileConverters but I don't know how to do anything with that. I am new to VB so that is part of the problem. VB says the fileconverters is a readonly property fileconverters[index 1 as object], [index 2 as object], as object. What does that mean? Is it a 2 dimensional array? How do I know what the bounds of that are? How can I see what is in each entry? What I am trying to do is open a non-excel file in excel without any user interaction. TIA JO |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to use FileConverters?
Sub Tester2()
Dim varr As Variant varr = Application.FileConverters Debug.Print LBound(varr, 1), UBound(varr, 1) Debug.Print LBound(varr, 2), UBound(varr, 2) For i = 1 To UBound(varr, 1) Debug.Print varr(i, 1), varr(i, 2), varr(i, 3) Next End Sub did you look in Excel VBA help for the FileConverters method? -- Regards, Tom Ogilvy "Josh Orfanakis" wrote in message ... In article , "Tom Ogilvy" wrote: I was thinking along those lines but I would like to enforce a specific converter. In addition I need to avoid any human interaction if possible. So I thought the more I tell it the less it will try and ask me. The problem is I don't know how to investigate the array returned from application.FileConverters. Could you shed some light on that for me? As I mentioned it appears to be multidimensional array, even if it was a single I don't know how to do this in VB. I am actually writing a C++ app but do my prototype in VB. In the TLH file a _variant_t [ ] [ ] [ ] is returned from the GetFileConverters. But that is a hurdle way down the list. First things first. Thank you for your reply. JO workbooks.open Filename:="C:\Myfolder\Myfile.dat" if Excel can open it, it will. If you can't open it manually by doing File=Open, then you won't be able to do it in VBA (unless you want to read it in binary using low level file io and write code to interpret the elements of the file). The only reason you might want to use the converter property is if Excel tries to open it with the wrong converter. Then you would look at the array returned by application.Fileconverters to determine the row number of the converter you want to use. The converter property tells excel to try that converter first. -- Regards, Tom Ogilvy "Josh Orfanakis" wrote in message ... I am trying to understand how to convert files with Excel automation. I see the parameter in the open method but I don't know what the possible options are. There is a readonly property Application.FileConverters but I don't know how to do anything with that. I am new to VB so that is part of the problem. VB says the fileconverters is a readonly property fileconverters[index 1 as object], [index 2 as object], as object. What does that mean? Is it a 2 dimensional array? How do I know what the bounds of that are? How can I see what is in each entry? What I am trying to do is open a non-excel file in excel without any user interaction. TIA JO |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
FileConverters property | Excel Programming |