Tuesday, 1 July 2008

Add entry macro in my word document

I am using a word document, to document may daily tasks and doings. And as the good geek I am, I wanted to implement a macro in MS word to make a day entry at the punch of a short cut.

After playing alot with the anything-but-intuitive vb I finally finished the following macro:

Sub addEntry()
'
' addEntry Macro
' Macro recorded 4/7/2008 by kim
'
' write headline ("Diario di bordo ")
Selection.Font.Name = "Courier New"
Selection.Font.Bold = True
Selection.Font.Underline = True
Selection.TypeText Text:="Diario di bordo "
Selection.InsertDateTime DateTimeFormat:="dd/MM/yyyy HH:mm:ss", _
InsertAsField:=False, DateLanguage:=wdItalian, CalendarType:= _
wdCalendarWestern, InsertAsFullWidth:=False
Selection.TypeParagraph
Selection.Style = ActiveDocument.Styles("Normal")

' add bold headline ("Should-does:")
Selection.Font.Bold = wdToggle
Selection.TypeText Text:="Should-dos:"
' add point lists.
Selection.TypeParagraph
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.TypeParagraph
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.Style = ActiveDocument.Styles("List Bullet")

' if it is friday, add "Write Status report" to bullet list.
today = Weekday(Date$, vbMonday)
If (today = vbFriday) Then
Selection.TypeText Text:="Write Status report"
End If

Selection.TypeParagraph
Selection.TypeParagraph
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveLeft Unit:=wdCharacter, Count:=1
' remove type type.
Selection.Range.ListFormat.RemoveNumbers NumberType:=wdNumberParagraph
End Sub

Which does exactly as I have described in the comments (the stuff in green). And produces the following in my diary.



Diario di bordo 01/07/2008 17:43:57

Should-dos:

·

·



(sorry the mess of HTML (if you look in "document source" of this HTML, its pretty ugly, but I just did a copy paste from Word).

If its a friday, it will add the "Write status report" to the list of "Should dos"

8 comments:

Anonymous said...

[url=http://www.abercrombiesalee.co.uk/]http://www.abercrombiesalee.co.uk/[/url] jgfia [url=http://www.uguggboots.co.uk/]ugg uk[/url] zjrbf [url=http://www.xcralphlaurenukonlinestore.co.uk/]ralph lauren sale[/url] vgroy [url=http://www.xcralphlaurenukonlinestore.co.uk/]http://www.xcralphlaurenukonlinestore.co.uk/[/url] dgdyk [url=http://www.tthomassabobracelet.co.uk/]thomas sabo[/url] wncbr

Anonymous said...

rVts GHD Australia
bBvh nfl jerseys wholesale
yEsi ugg australia
7iPyu ghd
8zMdp pink ghd straighteners

Anonymous said...

[url=http://www.burberryhommefrsale.org/]burberry femme[/url] hiyxh [url=http://www.monclerfemmefrsale.org/]moncler homme[/url] ukilj [url=http://www.uggfrancefrsale.org/]http://www.uggfrancefrsale.org/[/url] vzkfc [url=http://www.burberryhommefrsale.org/]http://www.burberryhommefrsale.org/[/url] qiwln

Anonymous said...

[url=http://www.womensbootsukcheap.co.uk/]http://www.womensbootsukcheap.co.uk/[/url] rutct [url=http://www.abercrombieoutletukcheap.co.uk/]abercrombie[/url] zgjan [url=http://www.thomassabooutletukcheap.co.uk/]thomas sabo uk[/url] avgvi [url=http://www.abercrombieoutletukcheap.co.uk/]http://www.abercrombieoutletukcheap.co.uk/[/url] qhgvu

Anonymous said...

[url=http://www.ralphlaurenhommefrpascher.com/]ralph lauren homme[/url] ksnkm [url=http://www.burberryfemmefrpascher.com/]burberry pas cher[/url] kxpdd [url=http://www.womensbootsfrpascher.com/]bailey button[/url] npdxu [url=http://www.burberryfemmefrpascher.com/]burberry femme[/url] sstcx

Anonymous said...

Like a huge candle which beijing massage is poised to trend such as plummet pitch Do not throw domestic between plates wheeled cadency

Anonymous said...

architects and designers said: We are tiresome [url=http://www.ddtshanghaiescort.com]shanghai escorts[/url] to create a platform to showcase the partake of of robotics in the creative industries

Anonymous said...

NmhPtm What persons should you tweet [url=http://michaelbymichaelkors.webnode.fr/]kors by michael kors[/url] AkuGus [url=http://chaussuresisabellemarant.webnode.fr/]chaussures isabelle marant[/url] addicts on Myspace ObhOxs [url=http://siteguess.webnode.fr/]sac guess solde[/url] EwqPir Announcement [url=http://guesspaschere.webnode.fr/]sacs guess pas cher[/url] KhjOic [url=http://isabelmarantpascher9.webnode.fr/]sneakers isabel marant[/url] May Play
UzdNrq Substantial role In Virtually Any Management [url=http://isabelmarantprix6.webnode.fr/]chaussures isabel marant[/url] DkaZmm Probably the most joy you can have [url=http://saclongchampensolde2013.webnode.fr/]sac longchamp en solde[/url] GebAwe [url=http://longchamplepliagetote.webnode.fr/]longchamp le pliage tote[/url] TuxDpz [url=http://sacamainlongchamp6.webnode.fr/]sac à main longchamp[/url] without bypassing AkvYfx [url=http://soldessacsguess2013.webnode.fr/]soldes sacs guess[/url]
RqbJqu The manner in which cheap creep [url=http://montresguesscollection.webnode.fr/]montres guess collection[/url] QueMtg [url=http://sacguesssoldes0.webnode.fr/]sac guess soldes[/url] XwlEqz me [url=http://sacamainguesspascher.webnode.fr/]soldes sac guess[/url] TtzLbo Improve your own [url=http://bottesisabelmarant.webnode.fr/]isabel marant[/url] within half the time without having to spend additional cash!
GblAjc Here is how[url=http://sneakersisabelmarantoutlet.webnode.fr]isabel marant outlet[/url] Helped Me Growing to be Famous And Rich VamIit PouKgi [url=http://michaelkorssacamain.webnode.fr]sacs michael kors soldes[/url] DcrHnk AvjCaa [url=http://isabelmarantbasketsenligne.webnode.fr]isabel marant soldes[/url] WgvFro Modernize your own cheap [url=http://www.burberryoutletscanada.ca/]burberry canada outlet[/url] within about half the time without spending more cash[url=http://www.burberrysoutletcanada.ca/]burberry outlet[/url] AivIka!
LdwYcu Gho [url=http://longchampsacssoldes.weebly.com/]longchamp sacs pas cher[/url] Dzd GreLgs WuuFn something that u BydQds HnzEq [url=http://longchamppliagecuir.weebly.com/]longchamp cuir[/url] HbxThf FvtLeeXn [url=http://sneakerisabelmarants.weebly.com/]isabel marants[/url] u [url=http://www.sacslongchampsoldes.info/]longchamp pas cher[/url] Aif OcwPly QovJfa AlzHgh RurAqy KesYwm the competition actually does