Active Member
Posts: 8
Registered: ‎12-11-2003
Message 1 of 2 (68 Views)

Need help with VB for Outlook Journaling & 2005

68 Views, 1 Replies
09-01-2006 01:05 PM
I grabbed someone's script from the forum, but it wasn't working properly.

I'm trying to modify this so that it will record the start time, end time (ie: duration in outlook journal) for documents when they are closed.

Currently, it is doing this when a document is saved, which isn't bad, but it is also making a new entry everytime you hit save.

I'd rather have it just make an entry when you 'close' a drawing. But I've made every attempt at it (being a newbie to VB) and have had no luck.

Can anyone help in modifying this to just make an entry in outlook/journal when a drawing is closed that includes:
start time, end time (duration), file name, file location (path).


This is how I have the code modified so far:

Option Explicit

Public WithEvents ACADApp As AcadApplication
Public MyOlApp As Object
Public MyOlItem As Object
Public MyTime As String
Public MyTimeEnd As String
Public Body As String

Sub AcadStartUp()
Set ACADApp = GetObject(, "AutoCAD.Application")
MyTime = Date + Time

ThisDrawing.SummaryInfo.AddCustomInfo "TimeStart", MyTime
ThisDrawing.SummaryInfo.SetCustomByKey "TimeStart", MyTime

End Sub

Private Sub ACADApp_BeginSave(ByVal FileName As String)
MyTimeEnd = Date + Time

ThisDrawing.SummaryInfo.AddCustomInfo "TimeEnd", MyTimeEnd
ThisDrawing.SummaryInfo.SetCustomByKey "TimeEnd", MyTimeEnd

Set MyOlApp = CreateObject("Outlook.Application")
Set MyOlItem = MyOlApp.CreateItem(olJournalItem)
MyOlItem.Type = "AutoCad"
ThisDrawing.SummaryInfo.GetCustomByKey "TimeStart", MyTime
MyOlItem.Start = MyTime
ThisDrawing.SummaryInfo.GetCustomByKey "TimeEnd", MyTimeEnd
MyOlItem.End = MyTimeEnd
While (ThisDrawing.SummaryInfo.NumCustomInfo >= 1)
ThisDrawing.SummaryInfo.RemoveCustomByIndex 0&
End Sub

Private Sub ACADApp_EndSave(ByVal FileName As String)
ThisDrawing.SummaryInfo.AddCustomInfo "TimeStart", MyTime
MyOlItem.Subject = ThisDrawing.GetVariable("dwgname")
Body = Body + "Drawing: " + ThisDrawing.Name + vbCr
Body = Body + "Drawing folder: " + ThisDrawing.Path + vbCr
MyOlItem.Body = Body
MyOlItem.Categories = "AutoCAD Drawing," + ThisDrawing.GetVariable("loginname") + "," + ThisDrawing.Path
End Sub

The attachment is the original file that I grabbed from these forums and modified.
*Russ Green
Message 2 of 2 (68 Views)

Re: Need help with VB for Outlook Journaling & 2005

09-30-2006 12:37 AM in reply to: sandsrfr
I would really like to get this working as well. i succesfully managed it in
microstation but that was easier to trap the open/close events as it is a
SDI rather than autocad that can multiple drawings open at once.

have you got anywhere with this?

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.