Hi All,

I have created a template which uses bookmarks and fieldforms to get data
from our database. we are a school and we have students always starting on
mondays except for public holiday. here is my problem

below is a macro found at woody's (great website)
I have 2 bookmarks (E_ST_DATE) & (public holiday) but when the macro is ran
it seem to caculate before e_st_date is updated because I get a return of
31/12/1899 as my result

Sub AutoNew()
Selection.GoTo What:=wdGoToBookmark, Name:="publicholiday"
Selection.InsertAfter Format((E_ST_DATE + 1), "dd/mm/yyyy")
End Sub

What I want to achieve is e.g (e_st_date = 10/09/2007 then publicholiday =
11/09/2007) The trouble is thou e_st_date will always change and I just want
to add 1 to wat ever date that is.

Please help

Re: Macro to auto update bookmark dates by Doug

Doug
Wed Sep 12 05:24:55 CDT 2007

You should use:

With ActiveDocument
.Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d", 1,
.Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
End With

However, you can do it without a macro. See fellow MVP Macropod's
DateCalc.Zip item that you can download from another Fellow MVP Graham
Mayor's website at http://www.gmayor.com/downloads.htm
--
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

"dates, dates and more dates"
<datesdatesandmoredates@discussions.microsoft.com> wrote in message
news:6E4CDD60-A143-431D-9A9B-325844243AAA@microsoft.com...
> Hi All,
>
> I have created a template which uses bookmarks and fieldforms to get data
> from our database. we are a school and we have students always starting on
> mondays except for public holiday. here is my problem
>
> below is a macro found at woody's (great website)
> I have 2 bookmarks (E_ST_DATE) & (public holiday) but when the macro is
> ran
> it seem to caculate before e_st_date is updated because I get a return of
> 31/12/1899 as my result
>
> Sub AutoNew()
> Selection.GoTo What:=wdGoToBookmark, Name:="publicholiday"
> Selection.InsertAfter Format((E_ST_DATE + 1), "dd/mm/yyyy")
> End Sub
>
> What I want to achieve is e.g (e_st_date = 10/09/2007 then publicholiday =
> 11/09/2007) The trouble is thou e_st_date will always change and I just
> want
> to add 1 to wat ever date that is.
>
> Please help
>
>
>
>
>



Re: Macro to auto update bookmark dates by datesdatesandmoredates

datesdatesandmoredates
Wed Sep 12 17:32:01 CDT 2007

Doug, Thank you for your response

I am looking into the datecalc document. However can I be pain,

The below macro looks good but I can not seem to make it work. Is it
possible to get the full macro (I think it is my copy and paste technique).

When I paste it doesn't like the ..bookmarks

Aaron



Aaron

"Doug Robbins - Word MVP" wrote:

> You should use:
>
> With ActiveDocument
> .Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d", 1,
> ..Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
> End With
>
> However, you can do it without a macro. See fellow MVP Macropod's
> DateCalc.Zip item that you can download from another Fellow MVP Graham
> Mayor's website at http://www.gmayor.com/downloads.htm
> --
> 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
>
> "dates, dates and more dates"
> <datesdatesandmoredates@discussions.microsoft.com> wrote in message
> news:6E4CDD60-A143-431D-9A9B-325844243AAA@microsoft.com...
> > Hi All,
> >
> > I have created a template which uses bookmarks and fieldforms to get data
> > from our database. we are a school and we have students always starting on
> > mondays except for public holiday. here is my problem
> >
> > below is a macro found at woody's (great website)
> > I have 2 bookmarks (E_ST_DATE) & (public holiday) but when the macro is
> > ran
> > it seem to caculate before e_st_date is updated because I get a return of
> > 31/12/1899 as my result
> >
> > Sub AutoNew()
> > Selection.GoTo What:=wdGoToBookmark, Name:="publicholiday"
> > Selection.InsertAfter Format((E_ST_DATE + 1), "dd/mm/yyyy")
> > End Sub
> >
> > What I want to achieve is e.g (e_st_date = 10/09/2007 then publicholiday =
> > 11/09/2007) The trouble is thou e_st_date will always change and I just
> > want
> > to add 1 to wat ever date that is.
> >
> > Please help
> >
> >
> >
> >
> >
>
>
>

Re: Macro to auto update bookmark dates by Doug

Doug
Thu Sep 13 04:38:35 CDT 2007

The mail program has inserted a line break in second line of code. In that
below, I have inserted a Visual Basic line break character (space then
underscore) that should overcome the problem

With ActiveDocument
.Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d", 1, _
.Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
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

"dates, dates and more dates"
<datesdatesandmoredates@discussions.microsoft.com> wrote in message
news:AC624D6B-F445-4681-A7A5-B609BDD202DB@microsoft.com...
> Doug, Thank you for your response
>
> I am looking into the datecalc document. However can I be pain,
>
> The below macro looks good but I can not seem to make it work. Is it
> possible to get the full macro (I think it is my copy and paste
> technique).
>
> When I paste it doesn't like the ..bookmarks
>
> Aaron
>
>
>
> Aaron
>
> "Doug Robbins - Word MVP" wrote:
>
>> You should use:
>>
>> With ActiveDocument
>> .Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d", 1,
>> ..Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
>> End With
>>
>> However, you can do it without a macro. See fellow MVP Macropod's
>> DateCalc.Zip item that you can download from another Fellow MVP Graham
>> Mayor's website at http://www.gmayor.com/downloads.htm
>> --
>> 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
>>
>> "dates, dates and more dates"
>> <datesdatesandmoredates@discussions.microsoft.com> wrote in message
>> news:6E4CDD60-A143-431D-9A9B-325844243AAA@microsoft.com...
>> > Hi All,
>> >
>> > I have created a template which uses bookmarks and fieldforms to get
>> > data
>> > from our database. we are a school and we have students always starting
>> > on
>> > mondays except for public holiday. here is my problem
>> >
>> > below is a macro found at woody's (great website)
>> > I have 2 bookmarks (E_ST_DATE) & (public holiday) but when the macro is
>> > ran
>> > it seem to caculate before e_st_date is updated because I get a return
>> > of
>> > 31/12/1899 as my result
>> >
>> > Sub AutoNew()
>> > Selection.GoTo What:=wdGoToBookmark, Name:="publicholiday"
>> > Selection.InsertAfter Format((E_ST_DATE + 1), "dd/mm/yyyy")
>> > End Sub
>> >
>> > What I want to achieve is e.g (e_st_date = 10/09/2007 then
>> > publicholiday =
>> > 11/09/2007) The trouble is thou e_st_date will always change and I just
>> > want
>> > to add 1 to wat ever date that is.
>> >
>> > Please help
>> >
>> >
>> >
>> >
>> >
>>
>>
>>



Re: Macro to auto update bookmark dates by datesdatesandmoredates

datesdatesandmoredates
Wed Sep 19 00:44:00 CDT 2007

Hi Doug or anyone,

I am now just becoming annoying. I deleted all macros what I had on my
template and copied ad pasted the following ... it looks exactly like below

With ActiveDocument
.Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d", 1, _
..Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
End With

However this says It is invalid. I am happy to send my template thru and get
a quote on getting it to work.

p.s I tried to use the datecal but it is not updateing from the bookmark so
I really want to get this macro to work.

Any assistance on this would be greatly appreciated.

Aaron


"Doug Robbins - Word MVP" wrote:

> The mail program has inserted a line break in second line of code. In that
> below, I have inserted a Visual Basic line break character (space then
> underscore) that should overcome the problem
>
> With ActiveDocument
> .Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d", 1, _
> ..Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
> 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
>
> "dates, dates and more dates"
> <datesdatesandmoredates@discussions.microsoft.com> wrote in message
> news:AC624D6B-F445-4681-A7A5-B609BDD202DB@microsoft.com...
> > Doug, Thank you for your response
> >
> > I am looking into the datecalc document. However can I be pain,
> >
> > The below macro looks good but I can not seem to make it work. Is it
> > possible to get the full macro (I think it is my copy and paste
> > technique).
> >
> > When I paste it doesn't like the ..bookmarks
> >
> > Aaron
> >
> >
> >
> > Aaron
> >
> > "Doug Robbins - Word MVP" wrote:
> >
> >> You should use:
> >>
> >> With ActiveDocument
> >> .Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d", 1,
> >> ..Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
> >> End With
> >>
> >> However, you can do it without a macro. See fellow MVP Macropod's
> >> DateCalc.Zip item that you can download from another Fellow MVP Graham
> >> Mayor's website at http://www.gmayor.com/downloads.htm
> >> --
> >> 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
> >>
> >> "dates, dates and more dates"
> >> <datesdatesandmoredates@discussions.microsoft.com> wrote in message
> >> news:6E4CDD60-A143-431D-9A9B-325844243AAA@microsoft.com...
> >> > Hi All,
> >> >
> >> > I have created a template which uses bookmarks and fieldforms to get
> >> > data
> >> > from our database. we are a school and we have students always starting
> >> > on
> >> > mondays except for public holiday. here is my problem
> >> >
> >> > below is a macro found at woody's (great website)
> >> > I have 2 bookmarks (E_ST_DATE) & (public holiday) but when the macro is
> >> > ran
> >> > it seem to caculate before e_st_date is updated because I get a return
> >> > of
> >> > 31/12/1899 as my result
> >> >
> >> > Sub AutoNew()
> >> > Selection.GoTo What:=wdGoToBookmark, Name:="publicholiday"
> >> > Selection.InsertAfter Format((E_ST_DATE + 1), "dd/mm/yyyy")
> >> > End Sub
> >> >
> >> > What I want to achieve is e.g (e_st_date = 10/09/2007 then
> >> > publicholiday =
> >> > 11/09/2007) The trouble is thou e_st_date will always change and I just
> >> > want
> >> > to add 1 to wat ever date that is.
> >> >
> >> > Please help
> >> >
> >> >
> >> >
> >> >
> >> >
> >>
> >>
> >>
>
>
>

Re: Macro to auto update bookmark dates by Russ

Russ
Wed Sep 19 01:21:03 CDT 2007

Aaron,
Doug's .bookmark line has to look to VBA as one whole line. The space with
underscore helps to break up long lines.
I can copy and paste what I have below into a subroutine with no problems.

You can use it to bump up the date. The bookmarks/data it refers to must
already exist in the document or you will get an error.

With ActiveDocument
.Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d", 1, _
.Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
End With


> Hi Doug or anyone,
>
> I am now just becoming annoying. I deleted all macros what I had on my
> template and copied ad pasted the following ... it looks exactly like below
>
> With ActiveDocument
> .Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d", 1, _
>
> ..Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
>
> End With
>
> However this says It is invalid. I am happy to send my template thru and get
> a quote on getting it to work.
>
> p.s I tried to use the datecal but it is not updateing from the bookmark so
> I really want to get this macro to work.
>
> Any assistance on this would be greatly appreciated.
>
> Aaron
>
>
> "Doug Robbins - Word MVP" wrote:
>
>> The mail program has inserted a line break in second line of code. In that
>> below, I have inserted a Visual Basic line break character (space then
>> underscore) that should overcome the problem
>>
>> With ActiveDocument
>> .Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d", 1, _
>> ..Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
>> 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
>>
>> "dates, dates and more dates"
>> <datesdatesandmoredates@discussions.microsoft.com> wrote in message
>> news:AC624D6B-F445-4681-A7A5-B609BDD202DB@microsoft.com...
>>> Doug, Thank you for your response
>>>
>>> I am looking into the datecalc document. However can I be pain,
>>>
>>> The below macro looks good but I can not seem to make it work. Is it
>>> possible to get the full macro (I think it is my copy and paste
>>> technique).
>>>
>>> When I paste it doesn't like the ..bookmarks
>>>
>>> Aaron
>>>
>>>
>>>
>>> Aaron
>>>
>>> "Doug Robbins - Word MVP" wrote:
>>>
>>>> You should use:
>>>>
>>>> With ActiveDocument
>>>> .Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d", 1,
>>>> ..Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
>>>> End With
>>>>
>>>> However, you can do it without a macro. See fellow MVP Macropod's
>>>> DateCalc.Zip item that you can download from another Fellow MVP Graham
>>>> Mayor's website at http://www.gmayor.com/downloads.htm
>>>> --
>>>> 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
>>>>
>>>> "dates, dates and more dates"
>>>> <datesdatesandmoredates@discussions.microsoft.com> wrote in message
>>>> news:6E4CDD60-A143-431D-9A9B-325844243AAA@microsoft.com...
>>>>> Hi All,
>>>>>
>>>>> I have created a template which uses bookmarks and fieldforms to get
>>>>> data
>>>>> from our database. we are a school and we have students always starting
>>>>> on
>>>>> mondays except for public holiday. here is my problem
>>>>>
>>>>> below is a macro found at woody's (great website)
>>>>> I have 2 bookmarks (E_ST_DATE) & (public holiday) but when the macro is
>>>>> ran
>>>>> it seem to caculate before e_st_date is updated because I get a return
>>>>> of
>>>>> 31/12/1899 as my result
>>>>>
>>>>> Sub AutoNew()
>>>>> Selection.GoTo What:=wdGoToBookmark, Name:="publicholiday"
>>>>> Selection.InsertAfter Format((E_ST_DATE + 1), "dd/mm/yyyy")
>>>>> End Sub
>>>>>
>>>>> What I want to achieve is e.g (e_st_date = 10/09/2007 then
>>>>> publicholiday =
>>>>> 11/09/2007) The trouble is thou e_st_date will always change and I just
>>>>> want
>>>>> to add 1 to wat ever date that is.
>>>>>
>>>>> Please help
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>
>>
>>

--
Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID


Re: Macro to auto update bookmark dates by datesdatesandmoredates

datesdatesandmoredates
Wed Sep 19 01:36:00 CDT 2007

Hi Russ,

I must be really stupid. I have copied and pasted what you said below but I
still get an error

---------------------------
Microsoft Visual Basic
---------------------------
Compile error:

Invalid outside procedure
---------------------------
OK Help
---------------------------

and it highlights the words With ActiveDocument

You mentioned a subroutine?? Should I have something that goes with the code?

Aaron
"Russ" wrote:

> Aaron,
> Doug's .bookmark line has to look to VBA as one whole line. The space with
> underscore helps to break up long lines.
> I can copy and paste what I have below into a subroutine with no problems.
>
> You can use it to bump up the date. The bookmarks/data it refers to must
> already exist in the document or you will get an error.
>
> With ActiveDocument
> ..Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d", 1, _
> ..Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
> End With
>
>
> > Hi Doug or anyone,
> >
> > I am now just becoming annoying. I deleted all macros what I had on my
> > template and copied ad pasted the following ... it looks exactly like below
> >
> > With ActiveDocument
> > .Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d", 1, _
> >
> > ..Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
> >
> > End With
> >
> > However this says It is invalid. I am happy to send my template thru and get
> > a quote on getting it to work.
> >
> > p.s I tried to use the datecal but it is not updateing from the bookmark so
> > I really want to get this macro to work.
> >
> > Any assistance on this would be greatly appreciated.
> >
> > Aaron
> >
> >
> > "Doug Robbins - Word MVP" wrote:
> >
> >> The mail program has inserted a line break in second line of code. In that
> >> below, I have inserted a Visual Basic line break character (space then
> >> underscore) that should overcome the problem
> >>
> >> With ActiveDocument
> >> .Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d", 1, _
> >> ..Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
> >> 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
> >>
> >> "dates, dates and more dates"
> >> <datesdatesandmoredates@discussions.microsoft.com> wrote in message
> >> news:AC624D6B-F445-4681-A7A5-B609BDD202DB@microsoft.com...
> >>> Doug, Thank you for your response
> >>>
> >>> I am looking into the datecalc document. However can I be pain,
> >>>
> >>> The below macro looks good but I can not seem to make it work. Is it
> >>> possible to get the full macro (I think it is my copy and paste
> >>> technique).
> >>>
> >>> When I paste it doesn't like the ..bookmarks
> >>>
> >>> Aaron
> >>>
> >>>
> >>>
> >>> Aaron
> >>>
> >>> "Doug Robbins - Word MVP" wrote:
> >>>
> >>>> You should use:
> >>>>
> >>>> With ActiveDocument
> >>>> .Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d", 1,
> >>>> ..Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
> >>>> End With
> >>>>
> >>>> However, you can do it without a macro. See fellow MVP Macropod's
> >>>> DateCalc.Zip item that you can download from another Fellow MVP Graham
> >>>> Mayor's website at http://www.gmayor.com/downloads.htm
> >>>> --
> >>>> 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
> >>>>
> >>>> "dates, dates and more dates"
> >>>> <datesdatesandmoredates@discussions.microsoft.com> wrote in message
> >>>> news:6E4CDD60-A143-431D-9A9B-325844243AAA@microsoft.com...
> >>>>> Hi All,
> >>>>>
> >>>>> I have created a template which uses bookmarks and fieldforms to get
> >>>>> data
> >>>>> from our database. we are a school and we have students always starting
> >>>>> on
> >>>>> mondays except for public holiday. here is my problem
> >>>>>
> >>>>> below is a macro found at woody's (great website)
> >>>>> I have 2 bookmarks (E_ST_DATE) & (public holiday) but when the macro is
> >>>>> ran
> >>>>> it seem to caculate before e_st_date is updated because I get a return
> >>>>> of
> >>>>> 31/12/1899 as my result
> >>>>>
> >>>>> Sub AutoNew()
> >>>>> Selection.GoTo What:=wdGoToBookmark, Name:="publicholiday"
> >>>>> Selection.InsertAfter Format((E_ST_DATE + 1), "dd/mm/yyyy")
> >>>>> End Sub
> >>>>>
> >>>>> What I want to achieve is e.g (e_st_date = 10/09/2007 then
> >>>>> publicholiday =
> >>>>> 11/09/2007) The trouble is thou e_st_date will always change and I just
> >>>>> want
> >>>>> to add 1 to wat ever date that is.
> >>>>>
> >>>>> Please help
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>>
> >>
> >>
> >>
>
> --
> Russ
>
> drsmN0SPAMikleAThotmailD0Tcom.INVALID
>
>

Re: Macro to auto update bookmark dates by Russ

Russ
Wed Sep 19 04:00:26 CDT 2007

Aaron,
Do you know how to create a macro?
You can name the subroutine with any name other than something that VBA
uses, unless you intentionally plan to intercept a VBA command.
No spaces or punctuation other than underscores allowed in a subroutine name
or a bookmark name. You can try what I have below. Remember I said the
bookmarks must already exist in the active document. Delete any double dots
or extra blank lines that may show up through the act of posting this
routine. There are no blank lines within the subroutine below.

Sub Move_Ahead_One_Day()
With ActiveDocument
.Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d", 1, _
.Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
End With
End Sub


> Hi Russ,
>
> I must be really stupid. I have copied and pasted what you said below but I
> still get an error
>
> ---------------------------
> Microsoft Visual Basic
> ---------------------------
> Compile error:
>
> Invalid outside procedure
> ---------------------------
> OK Help
> ---------------------------
>
> and it highlights the words With ActiveDocument
>
> You mentioned a subroutine?? Should I have something that goes with the code?
>
> Aaron
> "Russ" wrote:
>
>> Aaron,
>> Doug's .bookmark line has to look to VBA as one whole line. The space with
>> underscore helps to break up long lines.
>> I can copy and paste what I have below into a subroutine with no problems.
>>
>> You can use it to bump up the date. The bookmarks/data it refers to must
>> already exist in the document or you will get an error.
>>
>> With ActiveDocument
>> ..Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d", 1, _
>> ..Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
>> End With
>>
>>
>>> Hi Doug or anyone,
>>>
>>> I am now just becoming annoying. I deleted all macros what I had on my
>>> template and copied ad pasted the following ... it looks exactly like below
>>>
>>> With ActiveDocument
>>> .Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d", 1, _
>>>
>>> ..Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
>>>
>>> End With
>>>
>>> However this says It is invalid. I am happy to send my template thru and get
>>> a quote on getting it to work.
>>>
>>> p.s I tried to use the datecal but it is not updateing from the bookmark so
>>> I really want to get this macro to work.
>>>
>>> Any assistance on this would be greatly appreciated.
>>>
>>> Aaron
>>>
>>>
>>> "Doug Robbins - Word MVP" wrote:
>>>
>>>> The mail program has inserted a line break in second line of code. In that
>>>> below, I have inserted a Visual Basic line break character (space then
>>>> underscore) that should overcome the problem
>>>>
>>>> With ActiveDocument
>>>> .Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d", 1,
>>>> _
>>>> ..Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
>>>> 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
>>>>
>>>> "dates, dates and more dates"
>>>> <datesdatesandmoredates@discussions.microsoft.com> wrote in message
>>>> news:AC624D6B-F445-4681-A7A5-B609BDD202DB@microsoft.com...
>>>>> Doug, Thank you for your response
>>>>>
>>>>> I am looking into the datecalc document. However can I be pain,
>>>>>
>>>>> The below macro looks good but I can not seem to make it work. Is it
>>>>> possible to get the full macro (I think it is my copy and paste
>>>>> technique).
>>>>>
>>>>> When I paste it doesn't like the ..bookmarks
>>>>>
>>>>> Aaron
>>>>>
>>>>>
>>>>>
>>>>> Aaron
>>>>>
>>>>> "Doug Robbins - Word MVP" wrote:
>>>>>
>>>>>> You should use:
>>>>>>
>>>>>> With ActiveDocument
>>>>>> .Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d", 1,
>>>>>> ..Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
>>>>>> End With
>>>>>>
>>>>>> However, you can do it without a macro. See fellow MVP Macropod's
>>>>>> DateCalc.Zip item that you can download from another Fellow MVP Graham
>>>>>> Mayor's website at http://www.gmayor.com/downloads.htm
>>>>>> --
>>>>>> 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
>>>>>>
>>>>>> "dates, dates and more dates"
>>>>>> <datesdatesandmoredates@discussions.microsoft.com> wrote in message
>>>>>> news:6E4CDD60-A143-431D-9A9B-325844243AAA@microsoft.com...
>>>>>>> Hi All,
>>>>>>>
>>>>>>> I have created a template which uses bookmarks and fieldforms to get
>>>>>>> data
>>>>>>> from our database. we are a school and we have students always starting
>>>>>>> on
>>>>>>> mondays except for public holiday. here is my problem
>>>>>>>
>>>>>>> below is a macro found at woody's (great website)
>>>>>>> I have 2 bookmarks (E_ST_DATE) & (public holiday) but when the macro is
>>>>>>> ran
>>>>>>> it seem to caculate before e_st_date is updated because I get a return
>>>>>>> of
>>>>>>> 31/12/1899 as my result
>>>>>>>
>>>>>>> Sub AutoNew()
>>>>>>> Selection.GoTo What:=wdGoToBookmark, Name:="publicholiday"
>>>>>>> Selection.InsertAfter Format((E_ST_DATE + 1), "dd/mm/yyyy")
>>>>>>> End Sub
>>>>>>>
>>>>>>> What I want to achieve is e.g (e_st_date = 10/09/2007 then
>>>>>>> publicholiday =
>>>>>>> 11/09/2007) The trouble is thou e_st_date will always change and I just
>>>>>>> want
>>>>>>> to add 1 to wat ever date that is.
>>>>>>>
>>>>>>> Please help
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>>>
>>
>> --
>> Russ
>>
>> drsmN0SPAMikleAThotmailD0Tcom.INVALID
>>
>>

--
Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID


Re: Macro to auto update bookmark dates by Greg

Greg
Wed Sep 19 05:03:45 CDT 2007

Send your template and what you want done to me via e-mail.

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


dates, dates and more dates wrote:
> Hi Russ,
>
> I must be really stupid. I have copied and pasted what you said below
> but I still get an error
>
> ---------------------------
> Microsoft Visual Basic
> ---------------------------
> Compile error:
>
> Invalid outside procedure
> ---------------------------
> OK Help
> ---------------------------
>
> and it highlights the words With ActiveDocument
>
> You mentioned a subroutine?? Should I have something that goes with
> the code?
>
> Aaron
> "Russ" wrote:
>
>> Aaron,
>> Doug's .bookmark line has to look to VBA as one whole line. The
>> space with underscore helps to break up long lines.
>> I can copy and paste what I have below into a subroutine with no
>> problems.
>>
>> You can use it to bump up the date. The bookmarks/data it refers to
>> must already exist in the document or you will get an error.
>>
>> With ActiveDocument
>> ..Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d",
>> 1, _ ..Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
>> End With
>>
>>
>>> Hi Doug or anyone,
>>>
>>> I am now just becoming annoying. I deleted all macros what I had
>>> on my template and copied ad pasted the following ... it looks
>>> exactly like below
>>>
>>> With ActiveDocument
>>> .Bookmarks("publicholiday").Range.InsertBefore Format(DateAdd("d",
>>> 1, _
>>>
>>> ..Bookmarks("E_ST_DATE").Range.Text), "dd/mm/yyyy")
>>>
>>> End With
>>>
>>> However this says It is invalid. I am happy to send my template
>>> thru and get a quote on getting it to work.
>>>
>>> p.s I tried to use the datecal but it is not updateing from the
>>> bookmark so I really want to get this macro to work.
>>>
>>> Any assistance on this would be greatly appreciated.
>>>
>>> Aaron
>>>
>>>
>>> "Doug Robbins - Word MVP" wrote:
>>>
>>>> The mail program has inserted a line break in second line of code.
>>>> In that below, I have inserted a Visual Basic line break character
>>>> (space then underscore) that should overcome the problem
>>>>
>>>> With ActiveDocument
>>>> .Bookmarks("publicholiday").Range.InsertBefore
>>>> Format(DateAdd("d", 1, _ ..Bookmarks("E_ST_DATE").Range.Text),
>>>> "dd/mm/yyyy")
>>>> 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
>>>>
>>>> "dates, dates and more dates"
>>>> <datesdatesandmoredates@discussions.microsoft.com> wrote in message
>>>> news:AC624D6B-F445-4681-A7A5-B609BDD202DB@microsoft.com...
>>>>> Doug, Thank you for your response
>>>>>
>>>>> I am looking into the datecalc document. However can I be pain,
>>>>>
>>>>> The below macro looks good but I can not seem to make it work. Is
>>>>> it possible to get the full macro (I think it is my copy and paste
>>>>> technique).
>>>>>
>>>>> When I paste it doesn't like the ..bookmarks
>>>>>
>>>>> Aaron
>>>>>
>>>>>
>>>>>
>>>>> Aaron
>>>>>
>>>>> "Doug Robbins - Word MVP" wrote:
>>>>>
>>>>>> You should use:
>>>>>>
>>>>>> With ActiveDocument
>>>>>> .Bookmarks("publicholiday").Range.InsertBefore
>>>>>> Format(DateAdd("d", 1, ..Bookmarks("E_ST_DATE").Range.Text),
>>>>>> "dd/mm/yyyy")
>>>>>> End With
>>>>>>
>>>>>> However, you can do it without a macro. See fellow MVP
>>>>>> Macropod's DateCalc.Zip item that you can download from another
>>>>>> Fellow MVP Graham Mayor's website at
>>>>>> http://www.gmayor.com/downloads.htm --
>>>>>> 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
>>>>>>
>>>>>> "dates, dates and more dates"
>>>>>> <datesdatesandmoredates@discussions.microsoft.com> wrote in
>>>>>> message
>>>>>> news:6E4CDD60-A143-431D-9A9B-325844243AAA@microsoft.com...
>>>>>>> Hi All,
>>>>>>>
>>>>>>> I have created a template which uses bookmarks and fieldforms
>>>>>>> to get data
>>>>>>> from our database. we are a school and we have students always
>>>>>>> starting on
>>>>>>> mondays except for public holiday. here is my problem
>>>>>>>
>>>>>>> below is a macro found at woody's (great website)
>>>>>>> I have 2 bookmarks (E_ST_DATE) & (public holiday) but when the
>>>>>>> macro is ran
>>>>>>> it seem to caculate before e_st_date is updated because I get a
>>>>>>> return of
>>>>>>> 31/12/1899 as my result
>>>>>>>
>>>>>>> Sub AutoNew()
>>>>>>> Selection.GoTo What:=wdGoToBookmark, Name:="publicholiday"
>>>>>>> Selection.InsertAfter Format((E_ST_DATE + 1), "dd/mm/yyyy")
>>>>>>> End Sub
>>>>>>>
>>>>>>> What I want to achieve is e.g (e_st_date = 10/09/2007 then
>>>>>>> publicholiday =
>>>>>>> 11/09/2007) The trouble is thou e_st_date will always change
>>>>>>> and I just want
>>>>>>> to add 1 to wat ever date that is.
>>>>>>>
>>>>>>> Please help
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>>>
>>
>> --
>> Russ
>>
>> drsmN0SPAMikleAThotmailD0Tcom.INVALID