Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Tue, 23 May 2006 00:14:16 +0100,    group: microsoft.public.word.vba.userforms        back       


Inserting Alternate Dates for Lotto Draws   
Hi,
     Can anyone here help me with a project I am attempting with MS Word. I 
have an ten page document whereby I want to:

1) Insert a date range commencing with a Wednesday and ending on a Saturday 
covering an eight week period. The data needs to appear in pages 1 and 2 in 
the format "DD/MM/YY to DD/MM/YY". Can this be done by using an input form 
asking the question "What is the date of the first draw?

2) I then need to print the date of each of the eight draws commencing with 
the first Wednesday on page 3 and ending with draw eight on the last 
Saturday of the period on page 10.

Lastly, I then need to print the document with the inserted dates at anytime 
during the period.

I am only starting out with VBA so I would appreciate any help from list 
members.

Thanks in Advance,

Pat Curran
date: Tue, 23 May 2006 00:14:16 +0100   author:   Patrick Curran

Re: Inserting Alternate Dates for Lotto Draws   
Probably easiest way is to set up a spreadsheet in Excel in which you can 
alter the start date and you have formulae in the column to return the other 
dates that you want and then use mailmerge.

To do it with VBA, I would have an autonew macro in the template from which 
you create the document display an input box into which the date of the 
first Wednesday is entered by the user.  Code in the macro would then create 
document variables for each of the subsequent dates, and you would have 
docvariable fields in the appropriate places in the template to display the 
dates.

The code would be:

Dim i As Long
With ActiveDocument
    .Variables("w1").Value = InputBox("Enter the date of the first Wednesday 
in the format MM/dd/yy", "Lotto Dates")
    .Variables("s1").Value = Format(DateAdd("d", 3, .Variables("w1").Value), 
"MM/dd/yy")
    For i = 2 To 10
        .Variables("w" & i).Value = Format(DateAdd("d", (i - 1) * 7, 
..Variables("w1").Value), "MM/dd/yy")
        .Variables("s" & i).Value = Format(DateAdd("d", (i - 1) * 7, 
..Variables("s1").Value), "MM/dd/yy")
    Next i
End With


-- 
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Patrick Curran"  wrote in message 
news:e4tgk7$h35$1@reader01.news.esat.net...
> Hi,
>     Can anyone here help me with a project I am attempting with MS Word. I 
> have an ten page document whereby I want to:
>
> 1) Insert a date range commencing with a Wednesday and ending on a 
> Saturday covering an eight week period. The data needs to appear in pages 
> 1 and 2 in the format "DD/MM/YY to DD/MM/YY". Can this be done by using an 
> input form asking the question "What is the date of the first draw?
>
> 2) I then need to print the date of each of the eight draws commencing 
> with the first Wednesday on page 3 and ending with draw eight on the last 
> Saturday of the period on page 10.
>
> Lastly, I then need to print the document with the inserted dates at 
> anytime during the period.
>
> I am only starting out with VBA so I would appreciate any help from list 
> members.
>
> Thanks in Advance,
>
> Pat Curran
>
date: Tue, 23 May 2006 06:02:32 +0200   author:   Doug Robbins - Word MVP

Re: Inserting Alternate Dates for Lotto Draws   
Hi Patrick,

You can also achieve the desired result with field coding. To see how to do
this and just about everything else you might want to do with dates in Word,
check out my Date Calc 'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=249902

Cheers


"Patrick Curran"  wrote in message
news:e4tgk7$h35$1@reader01.news.esat.net...
> Hi,
>      Can anyone here help me with a project I am attempting with MS Word.
I
> have an ten page document whereby I want to:
>
> 1) Insert a date range commencing with a Wednesday and ending on a
Saturday
> covering an eight week period. The data needs to appear in pages 1 and 2
in
> the format "DD/MM/YY to DD/MM/YY". Can this be done by using an input form
> asking the question "What is the date of the first draw?
>
> 2) I then need to print the date of each of the eight draws commencing
with
> the first Wednesday on page 3 and ending with draw eight on the last
> Saturday of the period on page 10.
>
> Lastly, I then need to print the document with the inserted dates at
anytime
> during the period.
>
> I am only starting out with VBA so I would appreciate any help from list
> members.
>
> Thanks in Advance,
>
> Pat Curran
>
>
date: Tue, 23 May 2006 19:23:48 +1000   author:   macropod lid

Re: Inserting Alternate Dates for Lotto Draws   
Thanks Macropod - I'll spend some time with your attachment and let you know 
how I get on.

Pat
"macropod" <invalid@invalid.invalid> wrote in message 
news:4dg2agF1a6dviU1@individual.net...
> Hi Patrick,
>
> You can also achieve the desired result with field coding. To see how to 
> do
> this and just about everything else you might want to do with dates in 
> Word,
> check out my Date Calc 'tutorial', at:
> http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=249902
>
> Cheers
>
>
> "Patrick Curran"  wrote in message
> news:e4tgk7$h35$1@reader01.news.esat.net...
>> Hi,
>>      Can anyone here help me with a project I am attempting with MS Word.
> I
>> have an ten page document whereby I want to:
>>
>> 1) Insert a date range commencing with a Wednesday and ending on a
> Saturday
>> covering an eight week period. The data needs to appear in pages 1 and 2
> in
>> the format "DD/MM/YY to DD/MM/YY". Can this be done by using an input 
>> form
>> asking the question "What is the date of the first draw?
>>
>> 2) I then need to print the date of each of the eight draws commencing
> with
>> the first Wednesday on page 3 and ending with draw eight on the last
>> Saturday of the period on page 10.
>>
>> Lastly, I then need to print the document with the inserted dates at
> anytime
>> during the period.
>>
>> I am only starting out with VBA so I would appreciate any help from list
>> members.
>>
>> Thanks in Advance,
>>
>> Pat Curran
>>
>>
>
>
date: Tue, 23 May 2006 22:44:20 +0100   author:   Patrick Curran

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us