Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / General MS Word Questions / May 2008

Tip: Looking for answers? Try searching our database.

Insert Date make Bold Macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Walter_Slipperman - 09 May 2008 19:07 GMT
I don't know how to write macros but I do know how to record them and make
icons for them that I put on the toolbar.  Or I did back before Word 2007.

The goal is to have an icon always accessable on the toolbar, not in a
contextual menu, where I can select a macro that inserts the date in a
particular format and makes it bold and sets spacing following it.  I had
this in Word 2003.

When I try to use the record macro function to do the above operations I am
stuck because while the macro recorder is running, after I have inserted the
date in a selected format, I am not able to highlight the date text and make
it bold.  The little recorder icon hovers near the text but I can't select
the text.

What should i do?

\walter
Reitanos - 09 May 2008 19:16 GMT
You could either make it bold before inserting the date or use the
arrow keys + [Shift] to make the selection.

Also, there is a toolbar that you can customize at the top of the
window where you could add a custom button.

> I don't know how to write macros but I do know how to record them and make
> icons for them that I put on the toolbar.  Or I did back before Word 2007.
[quoted text clipped - 13 lines]
>
> \walter
Herb Tyson [MVP] - 09 May 2008 19:24 GMT
Use the keyboard rather than the mouse for the finishing touches. To select
the inserted date, try Ctrl+sh.t+Left arrow (if it's a date field, it'll
take just on push of the left key, otherwise it might take several depending
on the date format), press Ctrl+B, then use the right arrow to return the
insertion point to the end of the inserted date, then turn the recorder off.

In fact, I do the entire thing with the keyboard (Alt+Shift+D to insert the
date field). The macro I get is:

   Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldDate
   Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
   Selection.Font.Bold = wdToggle
   Selection.MoveRight Unit:=wdCharacter, Count:=1

Signature

Herb Tyson MS MVP
Author of the Word 2007 Bible
Blog: http://word2007bible.herbtyson.com
Web: http://www.herbtyson.com

>I don't know how to write macros but I do know how to record them and make
>icons for them that I put on the toolbar.  Or I did back before Word 2007.
[quoted text clipped - 13 lines]
>
> \walter
Walter_Slipperman - 09 May 2008 20:44 GMT
Okay.  thanks guys. I've got it working:

Sub bold_date()
'
' bold_date Macro
'
'
   Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldDate
   Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
   Selection.Font.Bold = wdToggle
   Selection.MoveRight Unit:=wdCharacter, Count:=1
   Selection.TypeParagraph
   Selection.Font.Bold = wdToggle
End Sub

Now how to do I put it in the small toolbar at the top.  In the past I would
make my own icon for it and drag it to the toolbar.

\Walter
Graham Mayor - 10 May 2008 06:33 GMT
Are you sure a date field is what you want here? A date field will update
each time you open the document. A CreateDate field would probably be more
useful - or as you are using vba, simply insert the date as text eg

Sub InsertUSFormatDate()
With Selection
   .Font.Bold = True
   .InsertDateTime DateTimeFormat:="MMMM" & Chr(160) & _
   "d," & Chr(160) & "yyyy", InsertAsField:=False
   .Font.Bold = False
   .TypeParagraph
End With
End Sub

To add a macro to the QAT (Quick Access Toolbar), see
http://www.gmayor.com/installing_macro.htm

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Okay.  thanks guys. I've got it working:
>
[quoted text clipped - 15 lines]
>
> \Walter

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.