Opening a .csv file thru a macro

V

vrzimmerm

I have a macro that starts by displaying the "open file" window so the
user can select a .csv file to be opened and then processed. It works
great in the US. I now have a colleague in Argentina that is
running this macro, and when the csv file is opened all the data is
just stuffed into column A. Normally, it should be spread across
cols. A thru W. To fix this I'd like to be able to either: 1.
tell my Argentinian colleague how to alter her default Excel settings
so that Excel will properly open the csv files on her PC, or, 2.
change the way the macro works so that it automatically displays the
"file open wizard" after she has selected the .csv that is to be
opened. Any Suggestions for how to do either of these options?

Thanks.
 
C

cht13er

I have a macro that starts by displaying the "open file" window so the
user can select a .csv file to be opened and then processed. It works
great in the US.    I now have a colleague in Argentina that is
running this macro, and when the csv file is opened all the data is
just stuffed into column A.   Normally,  it should be spread across
cols. A thru W.    To fix this I'd like to be able to either:  1.
tell my Argentinian colleague how to alter her default Excel settings
so that Excel will properly open the csv files on her PC,  or,  2.
change the way the macro works so that it automatically displays the
"file open wizard" after she has selected the .csv that is to be
opened.     Any Suggestions for how to do either of these options?

Thanks.

What are the differences in the settings?
 
D

dgp

I have a macro that starts by displaying the "open file" window so the
user can select a .csv file to be opened and then processed. It works
great in the US. I now have a colleague in Argentina that is
running this macro, and when the csv file is opened all the data is
just stuffed into column A. Normally, it should be spread across
cols. A thru W. To fix this I'd like to be able to either: 1.
tell my Argentinian colleague how to alter her default Excel settings
so that Excel will properly open the csv files on her PC, or, 2.
change the way the macro works so that it automatically displays the
"file open wizard" after she has selected the .csv that is to be
opened. Any Suggestions for how to do either of these options?

Thanks.

What code are you using to open the file?

This method seems to work for me when opening comma delimited text
files, but I'm not sure if language settings might break it:
Workbooks.OpenText Filename:=Path & "\MyTextFile.ext", _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False,
Comma:=True _
, Space:=False, Other:=True, OtherChar:="="
Set WbMyFile = ActiveWorkbook
 
V

vrzimmerm

What code are you using to open the file?

This method seems to work for me when opening comma delimited text
files, but I'm not sure if language settings might break it:
Workbooks.OpenText Filename:=Path & "\MyTextFile.ext", _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False,
Comma:=True _
, Space:=False, Other:=True, OtherChar:="="
Set WbMyFile = ActiveWorkbook


Here is the current code to open the .csv file

Dim FName As Variant
FName = Application.GetOpenFilename("Excel Files (*.csv),*.csv")
 

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