Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA opentext command

Hi- hope someone can help with this - its casuing me big problems.

I have just upgraded to excel (2003), and have an issue with when I am
opening text files in excel, using the opentext VBA command.
If I open the text file manually, I have no problem, all cells with dates in
them are recognised as dates. When I open this file and bring it in using
VBA, it recognises some of the dates as text, and so messes up my
calculations (have to press f2 and return in each cell to get them recognised
as a date).

I'm pretty sure that this is because it tries to bring them in in american
format for some reason, but has a problem when what it sees as the month
goes above 12 and therefore sees it as text (i.e
it brings it in as mm/dd/yyyy - however the file is dd/mm/yyyy do if dd12,
it sees it as mm12 therefore brings it in as text).

Additional info:
- date settings on my computer/excel are fine
- the file is a *.txt not *.csv
- Only happens when I use the VBA command (manual open is fine)

I think this is a bug (tried it on 5 computers)- any help would be
massively appreciated.

thanks in advnce
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA opentext command


If you post the code you are using for the import it will be easier to
find a resolution.

regards


--
tony h
------------------------------------------------------------------------
tony h's Profile: http://www.excelforum.com/member.php...o&userid=21074
View this thread: http://www.excelforum.com/showthread...hreadid=513124

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default VBA opentext command

Check out the OpenText method in Excel 2003 help. The last parameter is
Local. Set it to True.

--
Jim
"jz193" wrote in message
...
| Hi- hope someone can help with this - its casuing me big problems.
|
| I have just upgraded to excel (2003), and have an issue with when I am
| opening text files in excel, using the opentext VBA command.
| If I open the text file manually, I have no problem, all cells with dates
in
| them are recognised as dates. When I open this file and bring it in using
| VBA, it recognises some of the dates as text, and so messes up my
| calculations (have to press f2 and return in each cell to get them
recognised
| as a date).
|
| I'm pretty sure that this is because it tries to bring them in in american
| format for some reason, but has a problem when what it sees as the month
| goes above 12 and therefore sees it as text (i.e
| it brings it in as mm/dd/yyyy - however the file is dd/mm/yyyy do if
dd12,
| it sees it as mm12 therefore brings it in as text).
|
| Additional info:
| - date settings on my computer/excel are fine
| - the file is a *.txt not *.csv
| - Only happens when I use the VBA command (manual open is fine)
|
| I think this is a bug (tried it on 5 computers)- any help would be
| massively appreciated.
|
| thanks in advnce


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA opentext command

thanks for the replies- heres an exmaple of the code. Jim, I wasn't sure
what you meant by "last parameter", if you could clarify that would be great:

Workbooks.OpenText Filename:="R:\TEST.txt", Origin _
:=xlMSDOS, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True,
Semicolon:=True, _
Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(Array(1,
1), _
Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1),
Array(7, 1), TrailingMinusNumbers:=True


Any help much appreciated.
"Jim Rech" wrote:

Check out the OpenText method in Excel 2003 help. The last parameter is
Local. Set it to True.

--
Jim
"jz193" wrote in message
...
| Hi- hope someone can help with this - its casuing me big problems.
|
| I have just upgraded to excel (2003), and have an issue with when I am
| opening text files in excel, using the opentext VBA command.
| If I open the text file manually, I have no problem, all cells with dates
in
| them are recognised as dates. When I open this file and bring it in using
| VBA, it recognises some of the dates as text, and so messes up my
| calculations (have to press f2 and return in each cell to get them
recognised
| as a date).
|
| I'm pretty sure that this is because it tries to bring them in in american
| format for some reason, but has a problem when what it sees as the month
| goes above 12 and therefore sees it as text (i.e
| it brings it in as mm/dd/yyyy - however the file is dd/mm/yyyy do if
dd12,
| it sees it as mm12 therefore brings it in as text).
|
| Additional info:
| - date settings on my computer/excel are fine
| - the file is a *.txt not *.csv
| - Only happens when I use the VBA command (manual open is fine)
|
| I think this is a bug (tried it on 5 computers)- any help would be
| massively appreciated.
|
| thanks in advnce



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default VBA opentext command

Please do check out Help as that would answer your question. (Just add:
"Local:=True")

--
Jim
"jz193" wrote in message
...
| thanks for the replies- heres an exmaple of the code. Jim, I wasn't sure
| what you meant by "last parameter", if you could clarify that would be
great:
|
| Workbooks.OpenText Filename:="R:\TEST.txt", Origin _
| :=xlMSDOS, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
| xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True,
| Semicolon:=True, _
| Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(Array(1,
| 1), _
| Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1),
| Array(7, 1), TrailingMinusNumbers:=True
|
|
| Any help much appreciated.
| "Jim Rech" wrote:
|
| Check out the OpenText method in Excel 2003 help. The last parameter is
| Local. Set it to True.
|
| --
| Jim
| "jz193" wrote in message
| ...
| | Hi- hope someone can help with this - its casuing me big problems.
| |
| | I have just upgraded to excel (2003), and have an issue with when I am
| | opening text files in excel, using the opentext VBA command.
| | If I open the text file manually, I have no problem, all cells with
dates
| in
| | them are recognised as dates. When I open this file and bring it in
using
| | VBA, it recognises some of the dates as text, and so messes up my
| | calculations (have to press f2 and return in each cell to get them
| recognised
| | as a date).
| |
| | I'm pretty sure that this is because it tries to bring them in in
american
| | format for some reason, but has a problem when what it sees as the
month
| | goes above 12 and therefore sees it as text (i.e
| | it brings it in as mm/dd/yyyy - however the file is dd/mm/yyyy do if
| dd12,
| | it sees it as mm12 therefore brings it in as text).
| |
| | Additional info:
| | - date settings on my computer/excel are fine
| | - the file is a *.txt not *.csv
| | - Only happens when I use the VBA command (manual open is fine)
| |
| | I think this is a bug (tried it on 5 computers)- any help would be
| | massively appreciated.
| |
| | thanks in advnce
|
|
|




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA opentext command

Workbooks.OpenText Filename:="R:\TEST.txt", Origin _
:=xlMSDOS, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True,
Semicolon:=True, _
Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(Array(1,
1), _
Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1),
Array(7, 1), TrailingMinusNumbers:=True, Local:=True

--
Regards,
Tom Ogilvy



"jz193" wrote in message
...
thanks for the replies- heres an exmaple of the code. Jim, I wasn't sure
what you meant by "last parameter", if you could clarify that would be

great:

Workbooks.OpenText Filename:="R:\TEST.txt", Origin _
:=xlMSDOS, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True,
Semicolon:=True, _
Comma:=False, Space:=False, Other:=False,

FieldInfo:=Array(Array(1,
1), _
Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1),
Array(7, 1), TrailingMinusNumbers:=True


Any help much appreciated.
"Jim Rech" wrote:

Check out the OpenText method in Excel 2003 help. The last parameter is
Local. Set it to True.

--
Jim
"jz193" wrote in message
...
| Hi- hope someone can help with this - its casuing me big problems.
|
| I have just upgraded to excel (2003), and have an issue with when I am
| opening text files in excel, using the opentext VBA command.
| If I open the text file manually, I have no problem, all cells with

dates
in
| them are recognised as dates. When I open this file and bring it in

using
| VBA, it recognises some of the dates as text, and so messes up my
| calculations (have to press f2 and return in each cell to get them
recognised
| as a date).
|
| I'm pretty sure that this is because it tries to bring them in in

american
| format for some reason, but has a problem when what it sees as the

month
| goes above 12 and therefore sees it as text (i.e
| it brings it in as mm/dd/yyyy - however the file is dd/mm/yyyy do if
dd12,
| it sees it as mm12 therefore brings it in as text).
|
| Additional info:
| - date settings on my computer/excel are fine
| - the file is a *.txt not *.csv
| - Only happens when I use the VBA command (manual open is fine)
|
| I think this is a bug (tried it on 5 computers)- any help would be
| massively appreciated.
|
| thanks in advnce





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
OpenText Mike Archer Excel Programming 1 February 13th 06 09:22 PM
opentext command Ramesh Narasimhan Excel Programming 1 August 10th 05 11:48 AM
opentext banavas[_13_] Excel Programming 3 June 28th 04 02:25 PM
User defined file name in an OpenText File command surveyorinva Excel Programming 1 June 8th 04 06:40 PM
After OpenText all pastes from external apps use format from OpenText Jim[_31_] Excel Programming 1 November 8th 03 02:17 AM


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

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

About Us

"It's about Microsoft Excel"