Word VBA >> current week/date into Word 2000doc-incomplete code

by breeze » Sat, 24 Jul 2004 00:27:11 GMT

1) Yes , I would like date to be placed wherever the cursor is when I click
a toolbar button.
Problem is that still can no write code myself, so I dont know what
components should be added to this line

Selection.InsertBefore Format(Now, "ww, dd-MM-yyyy")


I can insert code into Module and can create the button on a toolbar.


2) As to first way you mentioned (place data at the *beginning* of every
document created from a particular template) -this not work, I tried
already. Most definitely, this code is incomplete, something incorrect:


Private Sub Document_New()

Selection.InsertBefore Format(Now, "ww, dd-MM-yyyy")

End Sub

I was just wondering if anybody could mail me complete code, for both
solutions.

Thanks,
breeze





"Jay Freedman" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...
> If you want this date to be placed at the beginning of every document
> created from a particular template, then yes, put the Document_New macro
in
> the ThisDocument module of that template.
>
> If instead you want the date to be placed wherever the cursor is when you
> click a toolbar button, then you must name the macro something else (not
one
> of the special Document_ names, and not any of the Auto macro names like
> AutoNew, and not the name of any built-in Word command) -- for example,
name
> it Public Sub WeekAndDate(). Also note that it must be Public, not
Private,
> and place it in a regular module created by clicking Insert > Module in
the
> VBA editor. After the macro is saved in the template, you can create the
> button on a toolbar by using the procedure at
> http://word.mvps.org/FAQs/Customization/AsgnCmdOrMacroToToolbar.htm.
>
> --
> Regards,
> Jay Freedman
> Microsoft Word MVP FAQ: http://word.mvps.org
>
> breeze wrote:
> > Hi Jay,
> >
> > Where this macros should be placed exactly - in ThisDocument
> > >Document_New() event ?
> >
> >
> > Private Sub Document_New()
> >
> > Selection.InsertBefore Format(Now, "ww, dd-MM-yyyy")
> >
> > End Sub
> >
> > How to run macro from document toolbar?
> >
> > Thanks
> >
> > "Jay Freedman" < XXXX@XXXXX.COM > wrote in message
> > news: XXXX@XXXXX.COM ...
> >> Hi breeze,
> >>
> >> The line
> >> Selection.InsertBefore Format(Now, "ww, dd-MM-yyyy")
> >> will insert the string at the current cursor position. If you want it
> >> somewhere else, you'll have to tell us what that location is.
> >>
> >> --
> >> Regards,
> >> Jay Freedman
> >> Microsoft Word MVP FAQ: http://word.mvps.org
> >>
> >> breeze wrote:
> >>> I need automatically insert current date into specific Word docs(not
> >>> for all) with the following format: 'ww, dd-mm-yyyy', where 'ww' is
> >>> current week from the beginning of year(now is 30). MS Word 2000
> >>> have no such date format in Insert > Date and Time >Available
> >>> Formats.
> >>>
> >>> Could someone help with right and convenient solution?(detail code
> >>> and description)
>
>




Similar Threads

1. current week/date into Word 2000doc- how to?

I need automatically insert current date into specific Word docs(not for
all)  with the following format: 'ww, dd-mm-yyyy', where 'ww' is current
week from the beginning of year(now is 30). MS Word 2000 have no such date
format  in Insert > Date and Time >Available Formats.

Could someone help with right and convenient solution?(detail code and
description)


2. Calendar default display current week+1 week prior + 2/3 weeks fut - Microsoft Office

3. How do I add two weeks to the current date in word

I need to add two weeks to the current date and place that date in a word 
document.

4. Keep date current Code in Word job - Word Document management

5. Word 2002 - Insert Date Field that shows "Week Beginning" date

6. Word 2002 - Insert Date Field that shows "Week Beginning" date onl - MS Word

7. Field codes - current date +90d

I want to include within an IF Statement a calculation of today's date plus 
90 days - is this possible?
-- 
Helbel78

8. Date changes from the desired date to current date when printing - Word Document management