Reply
 
Thread Tools Display Modes
  #1   Report Post  
Greg
 
Posts: n/a
Default Formatting Date fields

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.

--
Gregory M. La Due
Twin Tiers Technologies, Inc.
Senior Programmer

(800) 480-6467


  #2   Report Post  
Peter Jamieson
 
Posts: n/a
Default

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/show...?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
"Greg" wrote in message
...
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.

--
Gregory M. La Due
Twin Tiers Technologies, Inc.
Senior Programmer

(800) 480-6467




  #3   Report Post  
Graham Mayor
 
Posts: n/a
Default

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
http://www.wopr.com/cgi-bin/w3t/show...?Number=249902 to enable you to use
fields. If you know the mathematics involved this may help.

--

Graham Mayor - Word MVP

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




Greg wrote:
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.



  #4   Report Post  
macropod
 
Posts: n/a
Default

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

"Greg" wrote in message
...
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.

--
Gregory M. La Due
Twin Tiers Technologies, Inc.
Senior Programmer

(800) 480-6467




  #5   Report Post  
macropod
 
Posts: n/a
Default

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


"Graham Mayor" wrote in message
...
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
http://www.wopr.com/cgi-bin/w3t/show...?Number=249902 to enable you to

use
fields. If you know the mathematics involved this may help.

--

Graham Mayor - Word MVP

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




Greg wrote:
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.







  #6   Report Post  
Graham Mayor
 
Posts: n/a
Default

I was afraid that might be the case, but thought you might have been tempted
by the challenge

--

Graham Mayor - Word MVP

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




macropod wrote:
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


"Graham Mayor" wrote in message
...
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 http://www.wopr.com/cgi-bin/w3t/show...?Number=249902 to enable
you to use fields. If you know the mathematics involved this may
help.

--

Graham Mayor - Word MVP

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




Greg wrote:
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.



  #7   Report Post  
macropod
 
Posts: n/a
Default

Tempted, yes, but I haven't had the time to figure it out.

Cheers


"Graham Mayor" wrote in message
...
I was afraid that might be the case, but thought you might have been

tempted
by the challenge

--

Graham Mayor - Word MVP

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




macropod wrote:
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


"Graham Mayor" wrote in message
...
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 http://www.wopr.com/cgi-bin/w3t/show...?Number=249902 to enable
you to use fields. If you know the mathematics involved this may
help.

--

Graham Mayor - Word MVP

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




Greg wrote:
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.





  #8   Report Post  
macropod
 
Posts: n/a
Default

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


"Greg" wrote in message
...
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.

--
Gregory M. La Due
Twin Tiers Technologies, Inc.
Senior Programmer

(800) 480-6467




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
Form Fields lose bold formatting Ellen Microsoft Word Help 0 February 17th 05 09:11 PM
Date formatting in text form field, part II Ray_Johnson Microsoft Word Help 2 February 10th 05 10:01 PM
Date fields Walt G Microsoft Word Help 1 January 18th 05 05:57 PM
empty date fields in access Alan Mailmerge 4 January 13th 05 12:57 AM
Date formatting in text form field Ray_Johnson Microsoft Word Help 3 January 10th 05 11:18 AM


All times are GMT +1. The time now is 07:27 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"