This series of Word macros will create a new Journal entry in Outlook 2013 when you create a new Word document or open an existing Word document. It also reminds you to close the Journal item when you are done editing. A similar macro can be used with Excel.
To use, paste the code into Word's VB Editor and set a reference to the Outlook object model in Tools > References.
Sub autonew() Dim ol As New Outlook.Application Dim oJournal As JournalItem Dim fName As String fName = InputBox("Enter a Filename", "Subject") ActiveDocument.SaveAs fName Set oJournal = ol.CreateItem(olJournalItem) With oJournal .Subject = fName .Categories = "new doc" .Type = "Microsoft Word" .StartTimer .Save .Display End With Set ol = Nothing Exit Sub UserCancelled: Set ol = Nothing End Sub Sub autoopen() Dim ol As New Outlook.Application Dim oJournal As JournalItem Dim fName As String fName = ActiveDocument.Name Set oJournal = ol.CreateItem(olJournalItem) With oJournal .Subject = fName .Categories = "open doc" .Type = "Microsoft Word" .StartTimer .Save .Display End With Set ol = Nothing Exit Sub UserCancelled: Set ol = Nothing End Sub Sub autoclose() MsgBox "Don't forget to close the journal!" End Sub
Thanks for this, I've had the journal working for me for a while based on the hints you give above (I do a slightly different thing but essentially it achieves the same aim). However, I find the "Open" event is not working with sharepoint controlled documents, in particular for the case where the document is opened without checking it out, and then the "check-out" button is used in word (as opposed to using "check-out" directly in sharepoint. Is there an event I can use in word that will trigger when check-out/Check-in is used? Also I have implemented a similar structure in Excel but just can't seem to capture the open / close events. This is not a sharepoint issue, it just seems to be missing something. I've created the even references from VBA itself so I'm sure its not a simple spelling error etc. : Private WithEvents App As ApplicationPrivate Sub App_WorkbookOpen(ByVal Wb As Workbook) Call JournalStartEnd Sub One difference I can see is that Word still has a 'normal.docm' into which I can place these macros, while excel seems to have discontinued the related 'book.xls'. I have the macros in a xlsm located in the start-up folder, and most… Read more »
>> excel seems to have discontinued the related 'book.xls'.
the personal workbook is still supported.
Have you tried recording a macro and checking a document out? i know you can write to sharepoint fields, but i did not trying checking files out.
What changes are in the excel code and how do I plug it into Excel?
You need to use the auto start and auto exit macro names (i thought it was Workbook_Open & Workbook_BeforeClose, but it might be auto_open, auto_close) - and change activedocument to the one supported by excel (activeworkbook)
Is there an update for how to get this to work with office 2016? I use the journal extensively and am really angry the auto journaling no longer exists. Really appreciate that you have taken the time to figure this out. Thanks!
Thank you for this sharing.
I have two questions about this macros.
Don't you think that we can automatically create the journal entry in autoclose ?
Can I use autoopen() and autoclose() for eMails ?
I try several event to catch when a mail was created, but none are working. My goal is to record the time spend to write an e-mail.
These are word macros, not Outlook macros. autoopen and autoclose don't work in Outlook email, only in Word. To catch new mail, you need to watch for a new inspector. the code sample at https://www.slipstick.com/developer/code-samples/default-subject-messages/ watches for new items - it could create a journal item instead of setting the subject.
nd to know how to start writing in windows journal
The Windows Journal? Hit the Windows key on your keyboard and type journal to find the windows journal - then just start typing.
The Outlook Journal folder (what this article is about) is on Outlook's Folder list.
How do you add this code to Word?
In word, press Alt+F11 to open it's VBA editor and add it to the template then save.