Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2005

Tip: Looking for answers? Try searching our database.

VBA table sort using Date fails

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Julian Ladbury - 18 Feb 2005 08:05 GMT
I am sorting a table using the following parms:

excludeHeader:=True, FieldNumber:=1,
SortFieldType:=wdSortFieldDate,
sortOrder:=wdSortOrderAscending

In Word 2003 (but NOT in 2000) if there are blank lines
following the header line, the sort does nothing.

If I delete the lines and redo the sort it is fine.

If I then Undo the changes and redo the sort, it works
fine.

If I then close the file without saving changes, and then
reopen it, the sort continues to work fine. The only way
to get the problem back is to close Word entirely and
start again.

I have a doc to demonstrate this problem if anyone is
interested in investigating further.

NB Word 2000 does NOT have this problem.
Julian Ladbury - 01 Mar 2005 10:05 GMT
Adding the LanguageID parameter to the sort circumvents the problem.
For example:

   Set curTable = ThisDocument.Tables(1)
   Call curTable.Sort(excludeHeader:=True,
LanguageID:=curTable.Range.LanguageID, _
                       FieldNumber:=1, SortFieldType:=wdSortFieldDate,
sortOrder:=wdSortOrderAscending)

> I am sorting a table using the following parms:
>
[quoted text clipped - 19 lines]
>
> NB Word 2000 does NOT have this problem.

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.