#1   Report Post  
Posted to microsoft.public.word.docmanagement
TBoe
 
Posts: n/a
Default Macro question

I have about 50 Word documents that I have to change 4 date fields to
SaveDate format. I wanted to record a macro to delete the date, create a
text box, and
install the SaveDate field. Not being too familiar with macros, can this be
accomplished? I tried to record the macro but it won't let me delete text or
create a new line. The doc is not protected. Am I missing something? The
mouse cursor has the tape icon on it but I really cannot do any editing. Is
this nomal?

TY
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Charles Kenyon
 
Posts: n/a
Default Macro question

Why the text box? Generally fields in text boxes are not a good idea, and it
makes the programming a lot more tricky.

To get you started on handling a bunch of files, you might want to look at
http://word.mvps.org/FAQs/MacrosVBA/BatchFR.htm which is on doing a replace
on all files in a directory.

In your case it would be relatively simple to adapt this to replace all DATE
codes with SAVEDATE codes, which may not be what you want.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!

My criminal defense site: http://addbalance.com
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.


"TBoe" wrote in message
news
I have about 50 Word documents that I have to change 4 date fields to
SaveDate format. I wanted to record a macro to delete the date, create a
text box, and
install the SaveDate field. Not being too familiar with macros, can this
be
accomplished? I tried to record the macro but it won't let me delete text
or
create a new line. The doc is not protected. Am I missing something?
The
mouse cursor has the tape icon on it but I really cannot do any editing.
Is
this nomal?

TY


  #3   Report Post  
Posted to microsoft.public.word.docmanagement
TBoe
 
Posts: n/a
Default Macro question

Thanks for the info Charles. The reason for the text box was for formating
issues.
I guess I really don't need them. Next to the date is a sentence and I
thought
it would be easier if you had to enter a date then the test would not move.

"Charles Kenyon" wrote:

Why the text box? Generally fields in text boxes are not a good idea, and it
makes the programming a lot more tricky.

To get you started on handling a bunch of files, you might want to look at
http://word.mvps.org/FAQs/MacrosVBA/BatchFR.htm which is on doing a replace
on all files in a directory.

In your case it would be relatively simple to adapt this to replace all DATE
codes with SAVEDATE codes, which may not be what you want.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!

My criminal defense site: http://addbalance.com
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.


"TBoe" wrote in message
news
I have about 50 Word documents that I have to change 4 date fields to
SaveDate format. I wanted to record a macro to delete the date, create a
text box, and
install the SaveDate field. Not being too familiar with macros, can this
be
accomplished? I tried to record the macro but it won't let me delete text
or
create a new line. The doc is not protected. Am I missing something?
The
mouse cursor has the tape icon on it but I really cannot do any editing.
Is
this nomal?

TY




  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Charles Kenyon
 
Posts: n/a
Default Macro question

A table would do the same thing. The thing about text boxes is that they are
not in the same "layer" of the document as your regular text. It adds a big
level of complexity. If you want something in a margin, you could put it in
a frame (which acts a lot like a text box, but is still in the text layer).

The following code creates a frame with a SaveDate field for the left
margin.

Sub Macro6()
'
' Macro6 Macro
' Macro recorded 4/13/2006 by Charles Kyle Kenyon
'
With Selection
.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
"SAVEDATE \@ ""d-MMM-yy"" ", PreserveFormatting:=False
.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
ActiveDocument.Frames.Add Range:=Selection.Range
With .Frames(1)
.Select
.TextWrap = True
.WidthRule = wdFrameExact
.Width = InchesToPoints(0.8)
.HeightRule = wdFrameAuto
.HorizontalPosition = wdFrameLeft
.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
.VerticalPosition = InchesToPoints(0)
.RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
.HorizontalDistanceFromText = InchesToPoints(0.1)
.VerticalDistanceFromText = InchesToPoints(0)
.LockAnchor = False
End With
.Collapse
.ParagraphFormat.Alignment = wdAlignParagraphCenter
.TypeText Text:="Saved"
.TypeParagraph
End With
End Sub

It is very sloppy, based on recording. Run it to get a frame. Adjust the
formatting of the frame and the field until they are to your liking. Save
this as an AutoText entry.

Then, write your code to find date fields and in place of the date field
insert the Autotext entry, which will be the framed SaveDate field.

Hope this helps. I'm sure there is a more elegant way.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!

My criminal defense site: http://addbalance.com
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.


"TBoe" wrote in message
...
Thanks for the info Charles. The reason for the text box was for
formating
issues.
I guess I really don't need them. Next to the date is a sentence and I
thought
it would be easier if you had to enter a date then the test would not
move.

"Charles Kenyon" wrote:

Why the text box? Generally fields in text boxes are not a good idea, and
it
makes the programming a lot more tricky.

To get you started on handling a bunch of files, you might want to look
at
http://word.mvps.org/FAQs/MacrosVBA/BatchFR.htm which is on doing a
replace
on all files in a directory.

In your case it would be relatively simple to adapt this to replace all
DATE
codes with SAVEDATE codes, which may not be what you want.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!

My criminal defense site: http://addbalance.com
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.


"TBoe" wrote in message
news
I have about 50 Word documents that I have to change 4 date fields to
SaveDate format. I wanted to record a macro to delete the date, create
a
text box, and
install the SaveDate field. Not being too familiar with macros, can
this
be
accomplished? I tried to record the macro but it won't let me delete
text
or
create a new line. The doc is not protected. Am I missing something?
The
mouse cursor has the tape icon on it but I really cannot do any
editing.
Is
this nomal?

TY






  #5   Report Post  
Posted to microsoft.public.word.docmanagement
TBoe
 
Posts: n/a
Default Macro question

Great! Thanks for all your help Charles. I'll give it a try.

Terry

"Charles Kenyon" wrote:

A table would do the same thing. The thing about text boxes is that they are
not in the same "layer" of the document as your regular text. It adds a big
level of complexity. If you want something in a margin, you could put it in
a frame (which acts a lot like a text box, but is still in the text layer).

The following code creates a frame with a SaveDate field for the left
margin.

Sub Macro6()
'
' Macro6 Macro
' Macro recorded 4/13/2006 by Charles Kyle Kenyon
'
With Selection
.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
"SAVEDATE \@ ""d-MMM-yy"" ", PreserveFormatting:=False
.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
ActiveDocument.Frames.Add Range:=Selection.Range
With .Frames(1)
.Select
.TextWrap = True
.WidthRule = wdFrameExact
.Width = InchesToPoints(0.8)
.HeightRule = wdFrameAuto
.HorizontalPosition = wdFrameLeft
.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
.VerticalPosition = InchesToPoints(0)
.RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
.HorizontalDistanceFromText = InchesToPoints(0.1)
.VerticalDistanceFromText = InchesToPoints(0)
.LockAnchor = False
End With
.Collapse
.ParagraphFormat.Alignment = wdAlignParagraphCenter
.TypeText Text:="Saved"
.TypeParagraph
End With
End Sub

It is very sloppy, based on recording. Run it to get a frame. Adjust the
formatting of the frame and the field until they are to your liking. Save
this as an AutoText entry.

Then, write your code to find date fields and in place of the date field
insert the Autotext entry, which will be the framed SaveDate field.

Hope this helps. I'm sure there is a more elegant way.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!

My criminal defense site: http://addbalance.com
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.


"TBoe" wrote in message
...
Thanks for the info Charles. The reason for the text box was for
formating
issues.
I guess I really don't need them. Next to the date is a sentence and I
thought
it would be easier if you had to enter a date then the test would not
move.

"Charles Kenyon" wrote:

Why the text box? Generally fields in text boxes are not a good idea, and
it
makes the programming a lot more tricky.

To get you started on handling a bunch of files, you might want to look
at
http://word.mvps.org/FAQs/MacrosVBA/BatchFR.htm which is on doing a
replace
on all files in a directory.

In your case it would be relatively simple to adapt this to replace all
DATE
codes with SAVEDATE codes, which may not be what you want.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!

My criminal defense site: http://addbalance.com
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.


"TBoe" wrote in message
news I have about 50 Word documents that I have to change 4 date fields to
SaveDate format. I wanted to record a macro to delete the date, create
a
text box, and
install the SaveDate field. Not being too familiar with macros, can
this
be
accomplished? I tried to record the macro but it won't let me delete
text
or
create a new line. The doc is not protected. Am I missing something?
The
mouse cursor has the tape icon on it but I really cannot do any
editing.
Is
this nomal?

TY






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
FilePrint macro didn't work after all... janice Microsoft Word Help 11 March 28th 06 06:26 PM
Macro doesn't work Anna Microsoft Word Help 9 October 17th 05 10:25 PM
Macro Button Won't Stay on Toolbar caleb Microsoft Word Help 2 June 14th 05 11:59 PM
Save As is not working due to macro security settings Craig Meritz Microsoft Word Help 1 December 16th 04 03:53 AM
2000 to 2002 macro and "Could not open macro storage" Art Farrell Mailmerge 1 December 6th 04 12:40 PM


All times are GMT +1. The time now is 06:28 AM.

Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright 2004-2023 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"