Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Opening .xls files

I'm writing a macro that, as a first step, allows the user to open a
spreadsheet file of his/her choice. I am using "
Application.GetOpenFilename" to do this. Even tho the files the
user will open are .xls file types Excel seems to interpret them as
text files. (Whenever I try to manually open one of them Excel's Text
Import Wizard opens.)

How do I write a macro that will enable Excel to open these files once
the user has selected the specific .xls file? (Note: accepting
all the defaults in the Text Import Wizard results in a properly
formatted spreadsheet.)

Many thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default Opening .xls files

Sounds like something is funky with your code. You should be using
something like this:
Sub footer()
Dim fName As String
fName = Application.GetOpenFilename("Excel Files (*.xls),*.xls" _
, , "Select File")
If fName = "" Or fName = False Then Exit Sub
Workbooks.Open fName
End Sub

wrote:
I'm writing a macro that, as a first step, allows the user to open a
spreadsheet file of his/her choice. I am using "
Application.GetOpenFilename" to do this. Even tho the files the
user will open are .xls file types Excel seems to interpret them as
text files. (Whenever I try to manually open one of them Excel's Text
Import Wizard opens.)

How do I write a macro that will enable Excel to open these files once
the user has selected the specific .xls file? (Note: accepting
all the defaults in the Text Import Wizard results in a properly
formatted spreadsheet.)

Many thanks.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Opening .xls files

How do I write a macro that will enable Excel to open these files once the
user has selected the specific .xls file?


Dim FName As Variant
FName = Application.GetOpenFilename("Excel Files (*.xls),*.xls")
If Not FName = False Then Workbooks.Open FName

If Excel is opening the Text Import Wizard I'm almost positive that's what
they are, despite the extension. Excel analyzes the file itself rather than
rely on the extension.

If that is the case you might want to use the Workbooks.OpenText method and
have the parsing done automatically. Check VB help on OpenText to get all
the parameters.


--
Jim
wrote in message
ups.com...
| I'm writing a macro that, as a first step, allows the user to open a
| spreadsheet file of his/her choice. I am using "
| Application.GetOpenFilename" to do this. Even tho the files the
| user will open are .xls file types Excel seems to interpret them as
| text files. (Whenever I try to manually open one of them Excel's Text
| Import Wizard opens.)
|
| How do I write a macro that will enable Excel to open these files once
| the user has selected the specific .xls file? (Note: accepting
| all the defaults in the Text Import Wizard results in a properly
| formatted spreadsheet.)
|
| Many thanks.
|


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
show most recent files first when opening excel files Anne` Excel Discussion (Misc queries) 5 January 23rd 08 01:54 AM
Several files opening at once Buck[_2_] Setting up and Configuration of Excel 1 December 20th 07 08:57 AM
Opening Quattro Pro for Windows files (*.WB1 Files) using Excel 20 PoundMutt Excel Discussion (Misc queries) 1 June 20th 07 03:50 AM
How can I view files chronologically when opening multiple files Stevilsize Excel Discussion (Misc queries) 3 July 26th 05 12:49 AM
Opening Files Dave[_32_] Excel Programming 2 October 16th 03 06:25 PM


All times are GMT +1. The time now is 04:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"