A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Script to log run and close apps into Mircosoft Office journal



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 5th 07, 08:42 AM posted to microsoft.public.outlook.program_vba
Harpik
external usenet poster
 
Posts: 1
Default Script to log run and close apps into Mircosoft Office journal

I'm looking for some kind of automated logging into Microsoft Outlook
Journal.
I wish that script was started from command line start timer and that
apps, than after minut later check what is oppened from main bar. And
on closing that apps stop the timer and save new item into Microsoft
Outlook Journal. I have found sth like that (at end), but it is not
compatibile to new version of autocad, neither it cannot work with all
apps, but only Autocad or others that have VBA. After few minutes
using autocad it hangs apps, dont know why. But logging and so on is
ok.

Thanks for any clue.

Harpik

--- code ##---

Option Explicit
Public WithEvents ACADApp As AcadApplication ' Use with Application
Event Examples
Public myolapp As Object
Public myitem As Object
Public SALARYMANOPEN As Boolean
Public DOCUMENTNAME As String
Public REGVAL As Variant
Public FN

Sub AcadStartup()
' This example intializes the public variable (ACADApp) which will
be used
' to intercept AcadApplication Events
'
' The VBA WithEvents statement makes it possible to intercept an
generic Object
' with the events associated with that object.
'
' Before you will be able to trigger any of the AcadApplication
events,
' you will first need to run this procedure.

' We could get the application from the ThisDocument object, but
that would
' require having a drawing open, so we grab it from the system.
Set ACADApp = GetObject(, "AutoCAD.Application")
FN = GetVariable("DWGNAME")
Call ACADApp_EndOpen(FN)
End Sub

Private Sub ACADApp_BeginQuit(Cancel As Boolean)
If DOCUMENTNAME = "" Then End
myitem.Subject = DOCUMENTNAME
myitem.StopTimer
myitem.Save
SALARYMANOPEN = False
End Sub

Private Sub ACADApp_EndOpen(ByVal FileName As String)
If SALARYMANOPEN = True Then
myitem.Subject = DOCUMENTNAME
myitem.StopTimer
myitem.Save
End If
Set myolapp = CreateObject("Outlook.Application")
Set myitem = myolapp.CreateItem(4)
myitem.Type = "AutoCAD"
myitem.StartTimer
SALARYMANOPEN = True
DOCUMENTNAME = FileName
End Sub

--- end code ### ----

Ads
  #2  
Old February 6th 07, 06:10 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Script to log run and close apps into Mircosoft Office journal


In that sample I don't see why only Applications with VBA should be
supported.

You could have a list with all ProgIDs that you want to look for, like:
- "Excel.Application"
- "Word.Application.
- "Any.Application"
- etc.

In Visual Basic, e.g., you could write a standlone EXE with a timer. Once in
a minute call all your list items via GetObject. If it returns an error the
application runs else it doesn't.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)


Am 5 Feb 2007 00:42:51 -0800 schrieb Harpik:

I'm looking for some kind of automated logging into Microsoft Outlook
Journal.
I wish that script was started from command line start timer and that
apps, than after minut later check what is oppened from main bar. And
on closing that apps stop the timer and save new item into Microsoft
Outlook Journal. I have found sth like that (at end), but it is not
compatibile to new version of autocad, neither it cannot work with all
apps, but only Autocad or others that have VBA. After few minutes
using autocad it hangs apps, dont know why. But logging and so on is
ok.

Thanks for any clue.

Harpik

--- code ##---

Option Explicit
Public WithEvents ACADApp As AcadApplication ' Use with Application
Event Examples
Public myolapp As Object
Public myitem As Object
Public SALARYMANOPEN As Boolean
Public DOCUMENTNAME As String
Public REGVAL As Variant
Public FN

Sub AcadStartup()
' This example intializes the public variable (ACADApp) which will
be used
' to intercept AcadApplication Events
'
' The VBA WithEvents statement makes it possible to intercept an
generic Object
' with the events associated with that object.
'
' Before you will be able to trigger any of the AcadApplication
events,
' you will first need to run this procedure.

' We could get the application from the ThisDocument object, but
that would
' require having a drawing open, so we grab it from the system.
Set ACADApp = GetObject(, "AutoCAD.Application")
FN = GetVariable("DWGNAME")
Call ACADApp_EndOpen(FN)
End Sub

Private Sub ACADApp_BeginQuit(Cancel As Boolean)
If DOCUMENTNAME = "" Then End
myitem.Subject = DOCUMENTNAME
myitem.StopTimer
myitem.Save
SALARYMANOPEN = False
End Sub

Private Sub ACADApp_EndOpen(ByVal FileName As String)
If SALARYMANOPEN = True Then
myitem.Subject = DOCUMENTNAME
myitem.StopTimer
myitem.Save
End If
Set myolapp = CreateObject("Outlook.Application")
Set myitem = myolapp.CreateItem(4)
myitem.Type = "AutoCAD"
myitem.StartTimer
SALARYMANOPEN = True
DOCUMENTNAME = FileName
End Sub

--- end code ### ----

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Run A SCRIPT - Select Script EMPTY mitupan116 Outlook and VBA 1 November 2nd 06 09:36 PM
Office 12 Beta Apps- cost $1.50 each - Bobb - Outlook - General Queries 11 October 15th 06 03:17 AM
Office 12 Beta Apps- cost $1.50 each - Bobb - Outlook - General Queries 5 October 14th 06 01:17 AM
Rule 'run a script' not running my script [email protected] Outlook and VBA 3 May 30th 06 12:09 PM
"Run a script" rule triggers but script does not execute Trey Shaffer Outlook and VBA 7 April 7th 06 11:34 PM


All times are GMT +1. The time now is 05:37 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.