File open - .xls not recognized as spreadsheet

V

vrzimmerm

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?
 
G

Guest

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top