Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
 
Posts: n/a
Default VBA table sort by date fails intermittently

I have a product whose entire reason for existence is to sort
chronological tables. It was developed and tested using Word 2003, and
also tested on 2000 and 2002. It works fine.
Imagine my dismay when demonstrating it to possible customers yesterday
only to find that the sort feature did nothing!

I saved a copy of the offending file and brought it back to my testbed.
There was no problem sorting it, using both 2003 and 2000. The strange
thing is, the failure at the demo was under 2000 SR3 - the exact same
level of my 2000 testbed. Has anyone any idea what other Word or
Windows modules / release levels could be relevant to any further
investigation?

Looking through this forum, I feel my symptoms are the same as those in
thread
http://groups.google.com/group/micro...8800648a4e 12
Sadly this thread was never resolved.

All ideas gratefully appreciated.

  #2   Report Post  
Posted to microsoft.public.word.tables
Greg
 
Posts: n/a
Default VBA table sort by date fails intermittently

Julian,

This it just a stab, but are you certain that there is something there
to sort? See:
http://gregmaxey.mvps.org/Replace_With_Paragraph.htm

  #3   Report Post  
Posted to microsoft.public.word.tables
 
Posts: n/a
Default VBA table sort by date fails intermittently

Greg,
Thanks for the response, but yes there is something to sort. The
identical file works fine on my two testbeds, but failed on one
particular machine.

  #4   Report Post  
Posted to microsoft.public.word.tables
Cindy M -WordMVP-
 
Posts: n/a
Default VBA table sort by date fails intermittently

OK, I just skimmed the thread you mention. The questions asked there are similar
to what I would ask. Since you don't provide any of that information, I will ask
them again, in a slightly different form:

1. With which language is the table content formatted (Tools/Language/Set
language)

2. What are the date format settings in the Windows Control Panel, both on your
test machine and the machine you were using for the presentation?

3. Do all the machines have the same version of Windows installed?

4. Is the sort being performed manually, or using VBA code?

My inclination is that there may have been some problem with the Windows settings
on the presentation machine.

I have a product whose entire reason for existence is to sort
chronological tables. It was developed and tested using Word 2003, and
also tested on 2000 and 2002. It works fine.
Imagine my dismay when demonstrating it to possible customers yesterday
only to find that the sort feature did nothing!

I saved a copy of the offending file and brought it back to my testbed.
There was no problem sorting it, using both 2003 and 2000. The strange
thing is, the failure at the demo was under 2000 SR3 - the exact same
level of my 2000 testbed. Has anyone any idea what other Word or
Windows modules / release levels could be relevant to any further
investigation?

Looking through this forum, I feel my symptoms are the same as those in
thread

http://groups.google.com/group/micro...thread/thread/
f789b0d65fb5bbb7/0c8c8800648a4e12?q=sort+date&rnum=4#0c8c8800648a4e 12
Sadly this thread was never resolved.


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)

  #5   Report Post  
Posted to microsoft.public.word.tables
 
Posts: n/a
Default VBA table sort by date fails intermittently

Cindy,
Thanks for your interest. Taking your questions in order:
1. On my Word 2003 testbed, with the ofending file open,
Tools/Language/Set Language shows English(UK) highlighted and 'Detect
Language Automatically' is checked
2. Control Panel / Regional Options is set to English (United Kingdom)
on my testbed. I do not know what the demo machine settings were and am
unlikely to be able to find out. But if I stumble over the problem
again, I will be sure to check this.
3. Again, I don't know what Windows was running at the demo. My testbed
is XP SP2 with all the latest Office Update maintenance.
4. The sort is done in VBA.
Because of my lack of knowledge about the demo machine (I could hardly
ask the assembled throng to watch me diagnose an obscure problem in the
product I was selling!) I realise I am unlikely to get to the bottom of
this right away: but your pointers are useful. Thanks! Any other ideas
you or others might have will be gratefully received.



  #6   Report Post  
Posted to microsoft.public.word.tables
Tony Jollans
 
Posts: n/a
Default VBA table sort by date fails intermittently

A couple of things spring to my mind, both of which seem unlikely ...

1. Are you sure the Sort statement in VBA was actually executed?
2. Is there any chance the dates could have been in order according to the
date format on the customer machine?

Only slightly more likely - how have you coded your sort? Might a subset of
cells have been selected at the time and the "Sort Column Only" option be
switched on?

--
Enjoy,
Tony


wrote in message
ups.com...
I have a product whose entire reason for existence is to sort
chronological tables. It was developed and tested using Word 2003, and
also tested on 2000 and 2002. It works fine.
Imagine my dismay when demonstrating it to possible customers yesterday
only to find that the sort feature did nothing!

I saved a copy of the offending file and brought it back to my testbed.
There was no problem sorting it, using both 2003 and 2000. The strange
thing is, the failure at the demo was under 2000 SR3 - the exact same
level of my 2000 testbed. Has anyone any idea what other Word or
Windows modules / release levels could be relevant to any further
investigation?

Looking through this forum, I feel my symptoms are the same as those in
thread

http://groups.google.com/group/micro...owse_thread/th
read/f789b0d65fb5bbb7/0c8c8800648a4e12?q=sort+date&rnum=4#0c8c8800648a4e 12
Sadly this thread was never resolved.

All ideas gratefully appreciated.



  #7   Report Post  
Posted to microsoft.public.word.tables
 
Posts: n/a
Default VBA table sort by date fails intermittently

Tony,
1. The sort is executed by pressing a custom toolbar control. The
problem could be that for some reason the connection between this
button and the sort routine was broken in some way. However, I feel it
is more likely that the sort itself did not execute properly, for the
following reason.

When developing the routine, there was a circumstance in which the sort
failed under Word 2003 (but not 2000). Microsoft determined the cause
to be a failure of VBA to initialise the sort parameters properly (the
circumvention was to explicitly set the LanguageId to what it already
was:
Set curTable = ThisDocument.Tables(1)
Call curTable.Sort(excludeHeader:=True,
LanguageID:=curTable.Range.LanguageID, _
FieldNumber:=1, SortFieldType:=wdSortFieldDate,
sortOrder:=wdSortOrderAscending)
I suspect something similar may be going on here.

2. No, the dates would be out of order in any language.

The sort is coded much the same as the fragment above. No cells were
selected. I had certainly not selected 'Sort Column Only' - your post
is the first time I have come across it! Can it be a 'sticky' setting
across Word sessions, and thus possibly hung over from someone else?
(This is a rhetorical question - I will investigate it myself, I'm not
asking you to!)

  #8   Report Post  
Posted to microsoft.public.word.tables
Tony Jollans
 
Posts: n/a
Default VBA table sort by date fails intermittently

My vote would go for the toolbar control not firing the code. Difficult to
say more without knowing exactly what you have set up.

AFAIK, the sort coluimn only option is not saved acros sessions but is saved
within a session. Off the top of my head I'm not sure how the option set in
the UI might affect a VBA execution but don't think it will have any effect
on explicitly sorting the table.

--
Enjoy,
Tony


wrote in message
oups.com...
Tony,
1. The sort is executed by pressing a custom toolbar control. The
problem could be that for some reason the connection between this
button and the sort routine was broken in some way. However, I feel it
is more likely that the sort itself did not execute properly, for the
following reason.

When developing the routine, there was a circumstance in which the sort
failed under Word 2003 (but not 2000). Microsoft determined the cause
to be a failure of VBA to initialise the sort parameters properly (the
circumvention was to explicitly set the LanguageId to what it already
was:
Set curTable = ThisDocument.Tables(1)
Call curTable.Sort(excludeHeader:=True,
LanguageID:=curTable.Range.LanguageID, _
FieldNumber:=1, SortFieldType:=wdSortFieldDate,
sortOrder:=wdSortOrderAscending)
I suspect something similar may be going on here.

2. No, the dates would be out of order in any language.

The sort is coded much the same as the fragment above. No cells were
selected. I had certainly not selected 'Sort Column Only' - your post
is the first time I have come across it! Can it be a 'sticky' setting
across Word sessions, and thus possibly hung over from someone else?
(This is a rhetorical question - I will investigate it myself, I'm not
asking you to!)



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
20x20 multiplication table Bob S Tables 2 December 24th 05 03:27 PM
Table headers/footers and layout Keith Page Layout 1 April 8th 05 07:37 PM
Table AutoFormats vs. Table Styles confusion Tony Jollans Tables 5 March 6th 05 08:18 PM
Table Sort - Sort only 3 of 4 columns KGlennC Microsoft Word Help 2 February 26th 05 05:20 PM
Can't sort table alphabetically Tiffany Microsoft Word Help 1 January 21st 05 11:17 PM


All times are GMT +1. The time now is 11:37 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"