Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Opening an HTML doc - inconsistent results manual vs macro.

Hello all.

I'm running Excel 2000 SP3 on Win98SE.
I have several separate HTML documents generated by Papyrus Design Group
"Grand Prix Legends" which contain tables of Track Names, Lap Times and
Dates. I'm trying to import this data into Excel for analysis and
presentation, but I'm having problems.
If I manually open the HTML documents in Excel, I can easily copy & paste
data from the HTML page into my tables, and the results are fine.
However, I have tried to automate this process by recording a macro to:
1. open an HTML document,
2. select a range,
3. copy the data,
4. select the destination sheet and range,
5. paste the data,
6. close the HTML doc.
This code is run from a command button on the destination sheet, using the
"click" event.
When the macro is run, some (not all!) of the dates in the table have their
format corrupted.
I've cut the macro down until there is only the "Workbooks.Open" statement
left, and it appears that it is this open statement which is corrupting the
data. After running this statement on its own, the open HTML document is
displayed showing the corrupted dates.
In the original HTML documents, the dates are all in dd/mm/yy format, but
when Excel opens the documents with "Workbooks.Open", some of the dates get
switched to mm/dd/yy format (e.g. 09/02/04 becomes 02/09/04).
I have checked time and again that all the regional date settings I can find
in Office 2000 and Win98 are set to "U.K. English" or equivalent, and yet
this still happens. I am stumped.
Can anyone give me a fix for this problem? And can anyone explain why I
should get different results when manipulating the data manually vs using a
macro?

Thanks in advance for any help offered.

--
Keith Ballard
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default Opening an HTML doc - inconsistent results manual vs macro.

Hi Keith;

Several thing could be going on. Probably the best way to
work around the problem is to include a macro to reformat
the dating. It might look like this:

Sub try()
Selection.NumberFormat = "mm/dd/yy;@"
'or
Selection.NumberFormat = "dd/mm/yy;@"
End Sub

depending on which way you want it to go.

Also, Excel 2000 and above do not open html documents on
as friendly bases as 97. I would do a test and open a
test document where the values get corrupted in 2000 with
Excel 97 (Make sure it has the SP2) patch applied.

If it opens correctly in 97 but not 2000 then there are
tag errors comming from "Grand Prix Legends". I have run
into this before and found that I had missing <tr or <td
tags.

This is most likely what is going on.

Thanks,

Greg


-----Original Message-----
Hello all.

I'm running Excel 2000 SP3 on Win98SE.
I have several separate HTML documents generated by

Papyrus Design Group
"Grand Prix Legends" which contain tables of Track Names,

Lap Times and
Dates. I'm trying to import this data into Excel for

analysis and
presentation, but I'm having problems.
If I manually open the HTML documents in Excel, I can

easily copy & paste
data from the HTML page into my tables, and the results

are fine.
However, I have tried to automate this process by

recording a macro to:
1. open an HTML document,
2. select a range,
3. copy the data,
4. select the destination sheet and range,
5. paste the data,
6. close the HTML doc.
This code is run from a command button on the destination

sheet, using the
"click" event.
When the macro is run, some (not all!) of the dates in

the table have their
format corrupted.
I've cut the macro down until there is only

the "Workbooks.Open" statement
left, and it appears that it is this open statement which

is corrupting the
data. After running this statement on its own, the open

HTML document is
displayed showing the corrupted dates.
In the original HTML documents, the dates are all in

dd/mm/yy format, but
when Excel opens the documents with "Workbooks.Open",

some of the dates get
switched to mm/dd/yy format (e.g. 09/02/04 becomes

02/09/04).
I have checked time and again that all the regional date

settings I can find
in Office 2000 and Win98 are set to "U.K. English" or

equivalent, and yet
this still happens. I am stumped.
Can anyone give me a fix for this problem? And can anyone

explain why I
should get different results when manipulating the data

manually vs using a
macro?

Thanks in advance for any help offered.

--
Keith Ballard
.

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
WORKDAY() results appear to be inconsistent... dplum Excel Worksheet Functions 0 July 26th 08 05:59 PM
Formula results inconsistent. CyberTootie Excel Worksheet Functions 3 October 15th 06 03:20 PM
NETWORKDAYS calculation returns inconsistent results Analowl Excel Worksheet Functions 1 August 30th 06 02:28 AM
Inconsistent results with =LOOKUP? watkincm Excel Worksheet Functions 2 May 31st 06 08:21 PM
Inconsistent Array Count results Suzanne Excel Worksheet Functions 5 April 6th 06 05:02 PM


All times are GMT +1. The time now is 01:31 AM.

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"