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 / Mailmerge and Fax / April 2005

Tip: Looking for answers? Try searching our database.

Formatting Date fields

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Greg - 05 Apr 2005 21:56 GMT
Is there any way to use VBA to format date fields, bypassing the "\@" word
switch.

What I want to do is develop a date format that will take a standard date
and convert it to its hebrew calander equivalent while merging a document.

Signature

Gregory M. La Due
Twin Tiers Technologies, Inc.
Senior Programmer
gml@twintierstech.com
(800) 480-6467

Peter Jamieson - 06 Apr 2005 10:00 GMT
There are a few ways you could approach this, depending on how simple the
conversion algorithm is.

First, I would want to be sure that using a Hebrew-language enabled version
of Word would not let you do it. If it can, that might be your best bet.

You may be able to do the calculation in the data source (might be possible
if for example you are using a server such as SQl Server or Oracle, or can
use an Access Query. In the latter case, the algorithm either needs to be
expressible in a single VBA function that you can put in a query, or you
need to write a function in Access VBA module, reference it in an Access
query, and use the DDE connection method to open the data source).

If the algorithm requires no looping you might be able to do it just using
field calculations. macropod's Word document at

http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=249902

has pointers on how to do that although I don't think it currently has code
to do exactly what you need.

Again, if the algorithm can be expressed in a single, reasonably short, VBA
expression, you might be able to use a DATABASE field in Word to do the
calculation. If you search google groups for recent messages in this group
with Peter Jamieson DATABASE, you will probably find an article on how to do
that.

Otherwise, you would need either to merge to an output document and
postprocess all the dates using VBA (in which case you need some way to
locate the dates, e.g. using "placehoder" characters, or you need to use VBA
MailMerge events to do the calculation for each data source record.

Peter Jamieson

Otherwise, you will
> Is there any way to use VBA to format date fields, bypassing the "\@" word
> switch.
>
> What I want to do is develop a date format that will take a standard date
> and convert it to its hebrew calander equivalent while merging a document.
Graham Mayor - 06 Apr 2005 13:43 GMT
Just a thought, as I know nothing about the calculations involved in
converting between the dates, it may be possible to adapt the methods used
to convert between Gregorian and Julian dates explained at
www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=249902 to enable you to use
fields. If you know the mathematics involved this may help.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Is there any way to use VBA to format date fields, bypassing the "\@"
> word switch.
>
> What I want to do is develop a date format that will take a standard
> date and convert it to its hebrew calander equivalent while merging a
> document.
macropod - 07 Apr 2005 08:25 GMT
Hi Graham,

Unfortunately, I don't know the maths for the Hebrew calendar either. But I
do know it is more complicated than for Gregorian & Julian calendars. See
http://www.tondering.dk/claus/cal/node4.html for more details.

Cheers

> Just a thought, as I know nothing about the calculations involved in
> converting between the dates, it may be possible to adapt the methods used
[quoted text clipped - 8 lines]
> > date and convert it to its hebrew calander equivalent while merging a
> > document.
Graham Mayor - 07 Apr 2005 09:35 GMT
I was afraid that might be the case, but thought you might have been tempted
by the challenge ;)

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Hi Graham,
>
[quoted text clipped - 26 lines]
>>> date and convert it to its hebrew calander equivalent while merging
>>> a document.
macropod - 08 Apr 2005 11:10 GMT
Tempted, yes, but I haven't had the time to figure it out.

Cheers

> I was afraid that might be the case, but thought you might have been tempted
> by the challenge ;)
[quoted text clipped - 29 lines]
> >>> date and convert it to its hebrew calander equivalent while merging
> >>> a document.
macropod - 06 Apr 2005 13:56 GMT
Hi Greg,

If you merge the date as a purely numeric string (eg ddmmyyyy), you could
use vba to format the output with a numeric picture switch. For example:
\# "00'-'00'-'0000"
This will give a pseudo-numeric representation of the date.

If, however, you're trying to get away from switches altogether, and you're
not happy with the date format you get using no switches, I think you're
going to have to use a purely vba solution to format the date as you require
and paste it into the document as normal text.

Cheers

> Is there any way to use VBA to format date fields, bypassing the "\@" word
> switch.
>
> What I want to do is develop a date format that will take a standard date
> and convert it to its hebrew calander equivalent while merging a document.
macropod - 10 Apr 2005 00:27 GMT
Hi Greg,

I did a bit of searching and found this site, which has implemented many
inter-calendar conversions using vb/vba:
http://couprie.docspages.com/calmath/

HTH

Cheers

> Is there any way to use VBA to format date fields, bypassing the "\@" word
> switch.
>
> What I want to do is develop a date format that will take a standard date
> and convert it to its hebrew calander equivalent while merging a document.
 
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.