ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   File open - .xls not recognized as spreadsheet (https://www.excelbanter.com/excel-programming/397649-file-open-xls-not-recognized-spreadsheet.html)

[email protected]

File open - .xls not recognized as spreadsheet
 
I'm trying to write a macro where the first step is to turn control
over to the user to specify a spreadsheet file that is to be opened.
I am using the "Application.GetOpenFilename" command to do this.

It seems that even tho the file to be opened is a .xls file Excel
doesn't recognize it as a spreadsheet - it seems to treat this as a
text file. (Note: when I try to open this same .xls file Excel
responds by opening the Text Import Wizard window. Proceeding using
the default options then works fine.) How can I have the macro
proceed with the opening of the specified file by recognizing tabs as
the delimiter between the columns?


joel

File open - .xls not recognized as spreadsheet
 
try this

Workbooks.Open Filename:=Filename, Format:=2

Format Optional Variant. If Microsoft Excel is opening a text file, this
argument specifies the delimiter character, as shown in the following table.
If this argument is omitted, the current delimiter is used.

Value Delimiter
1 Tabs
2 Commas
3 Spaces
4 Semicolons
5 Nothing
6 Custom character (see the Delimiter argument)


" wrote:

I'm trying to write a macro where the first step is to turn control
over to the user to specify a spreadsheet file that is to be opened.
I am using the "Application.GetOpenFilename" command to do this.

It seems that even tho the file to be opened is a .xls file Excel
doesn't recognize it as a spreadsheet - it seems to treat this as a
text file. (Note: when I try to open this same .xls file Excel
responds by opening the Text Import Wizard window. Proceeding using
the default options then works fine.) How can I have the macro
proceed with the opening of the specified file by recognizing tabs as
the delimiter between the columns?




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

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