Home |
Search |
Today's Posts |
|
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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. |
#5
|
|||
|
|||
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. |
#6
|
|||
|
|||
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. |
#7
|
|||
|
|||
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 |
#8
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Form Fields lose bold formatting | Microsoft Word Help | |||
Date formatting in text form field, part II | Microsoft Word Help | |||
Date fields | Microsoft Word Help | |||
empty date fields in access | Mailmerge | |||
Date formatting in text form field | Microsoft Word Help |