richardm
Philosopher
- Joined
- Aug 6, 2001
- Messages
- 9,248
Hi all...
I'm working on an old application that uses DDE to transfer data to an Excel spreadsheet. It nearly works, except it treats all numeric data as numbers, which isn't always the case.
So the app is using the following macro to get Excel to open the datafile:
Open("c:\sheet.xls", 1)
sheet.xls is a tab delimited file, and it works okay except for the conversion problem.
I've dug out a copy of macrofun.hlp, and I think I can fix this by using the macro "open.text". This basically has parameters equivalent to the Text Import Wizard. It has this syntax:
OPEN.TEXT(file_name, file_origin, start_row, file_type, text_qualifier, consecutive_delim, tab, semicolon, comma, space, other, other_char, {field_info1; field_info2;...})
I'm fine with all the parameters, except for the last "field_info" section. If I omit it, the file loads. However, I need that section, because that's what I use to map the correct datatypes onto the columns of data - it is
Thing is, I can't figure out what this should look like in my command. At the moment I have something like:
OPEN.TEXT("c:\sheet.xls",2, 1,1, 3, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, {{1,2}; {2,2};{3,2}})
... and it doesn't work. Again, if I omit the bolded part, it works fine.
Can anyone help with what I should have in there?
Alternatively, is it possible to construct visual basic instructions and pass them through DDE instead?
Thanks!
I'm working on an old application that uses DDE to transfer data to an Excel spreadsheet. It nearly works, except it treats all numeric data as numbers, which isn't always the case.
So the app is using the following macro to get Excel to open the datafile:
Open("c:\sheet.xls", 1)
sheet.xls is a tab delimited file, and it works okay except for the conversion problem.
I've dug out a copy of macrofun.hlp, and I think I can fix this by using the macro "open.text". This basically has parameters equivalent to the Text Import Wizard. It has this syntax:
OPEN.TEXT(file_name, file_origin, start_row, file_type, text_qualifier, consecutive_delim, tab, semicolon, comma, space, other, other_char, {field_info1; field_info2;...})
I'm fine with all the parameters, except for the last "field_info" section. If I omit it, the file loads. However, I need that section, because that's what I use to map the correct datatypes onto the columns of data - it is
an array which consists of the following elements: "column number, data_format"
Thing is, I can't figure out what this should look like in my command. At the moment I have something like:
OPEN.TEXT("c:\sheet.xls",2, 1,1, 3, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, {{1,2}; {2,2};{3,2}})
... and it doesn't work. Again, if I omit the bolded part, it works fine.
Can anyone help with what I should have in there?
Alternatively, is it possible to construct visual basic instructions and pass them through DDE instead?
Thanks!