vba lockup

vba lockup

Anonymous
Not applicable
379 Views
4 Replies
Message 1 of 5

vba lockup

Anonymous
Not applicable
I have modified Autojournal (from autojournal.net, free source code
download) for my use. I simply changed it so that it did not have to track
time of use for each document but merely when a document was opened. I will
work on the time tracking if I can get this to work.

I used the following code with a sub of AcadStartup that merely initializes
the AcadApplication Events. Everything seems to work fine if I run the macro
"AcadStartup" at the command line after starting Acad 2000. Every following
document is logged in the Outlook Journal.

My problem is that when I put the line (command "-vbarun" "acadstartup") at
the end of acad2000.lsp or acad2000doc.lsp the module locks me up. Acad acts
as though there is a command in process but I cannot do anything. When I
type at the command prompt the curser moves over like text is being typed
but nothing appears on screen. I cannot escape out of the command not
execute and menu command. When I attempt to exit Acad I am told that a
command is in process and I need to exit the command before I can exit Acad.
I have to force Acad to exit by using the task manager.

Here's an even weirder twist. The code is set to skip any "Drawing*"
documents as I do not want any new documents logged, only saved documents so
when Acad is started with the (command "-vbarun" "acadstartup") in the
acad2000doc.lsp it will not
lock up until I open another document. So after initially starting Acad I
bring up the vba editor, toggle a breakpoint to follow the code and then
everything works just fine. No lockup! I am at a loss as to how to
troubleshoot this. Any Ideas?



--
Joel
joel@NSPM.harden-assoc.com
remove the NSPM. to email me directly


'''
'''
Public WithEvents ACADApp As AcadApplication ' Use with Application Event
Examples
'''
''' using outlook - be sure to go to Tools > References
''' and add the Microsoft Outlook library to the project
'''
Public oOutlookApp As Outlook.Application
Public oJournal As Outlook.JournalItem

'''
''' declare a couple of variables for managing the journal
'''
Private strFilename As String
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")

End Sub
Private Sub ACADApp_EndOpen(ByVal FileName As String)

''get documents name
strFilename = ThisDrawing.Name

'' exit if no document name
If strFilename = "" Then Exit Sub

'' exit if this is a new drawing
If strFilename Like "Drawing*" Then Exit Sub

'' start a new journal entry
StartJournal
End Sub

'''
''' start journal - helper routine
'''
Private Sub StartJournal()

'' get the outlook application
Set oOutlookApp = CreateObject("Outlook.Application")

'' create a new journal entry
Set oJournal = oOutlookApp.CreateItem(olJournalItem)

'' set the category, and start timing
With oJournal
.Subject = strFilename
.Type = "AutoCAD"
.Save
End With
End Sub
0 Likes
380 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Can anyone explain this?
I took out the (command -vbarun... from acad2000.lsp and acad2000doc.lsp.
acad.dvb is in the support path and is loaded properly but won't run the
thisdrawing events unless I open the vba editor window. Once I open the
window then acad intercepts the thisdrawing events and the code works like
it is supposed to. Is the action of loading the VBA window doing something
other than showing me the code?

--
Joel
joel@NSPM.harden-assoc.com
remove the NSPM. to email me directly
0 Likes
Message 3 of 5

Anonymous
Not applicable
Yip I have exactly the same thing. I think I read if you issue a command of
the name "vba..." it initializes these events I haven't work out how but I
think you need to use s::startup to get around this
"Joel Zimmerman" wrote in message
news:16363F0D73F4668354D28ED92A2979F8@in.WebX.maYIadrTaRb...
> I have modified Autojournal (from autojournal.net, free source code
> download) for my use. I simply changed it so that it did not have to track
> time of use for each document but merely when a document was opened. I
will
> work on the time tracking if I can get this to work.
>
> I used the following code with a sub of AcadStartup that merely
initializes
> the AcadApplication Events. Everything seems to work fine if I run the
macro
> "AcadStartup" at the command line after starting Acad 2000. Every
following
> document is logged in the Outlook Journal.
>
> My problem is that when I put the line (command "-vbarun" "acadstartup")
at
> the end of acad2000.lsp or acad2000doc.lsp the module locks me up. Acad
acts
> as though there is a command in process but I cannot do anything. When I
> type at the command prompt the curser moves over like text is being typed
> but nothing appears on screen. I cannot escape out of the command not
> execute and menu command. When I attempt to exit Acad I am told that a
> command is in process and I need to exit the command before I can exit
Acad.
> I have to force Acad to exit by using the task manager.
>
> Here's an even weirder twist. The code is set to skip any "Drawing*"
> documents as I do not want any new documents logged, only saved documents
so
> when Acad is started with the (command "-vbarun" "acadstartup") in the
> acad2000doc.lsp it will not
> lock up until I open another document. So after initially starting Acad I
> bring up the vba editor, toggle a breakpoint to follow the code and then
> everything works just fine. No lockup! I am at a loss as to how to
> troubleshoot this. Any Ideas?
>
>
>
> --
> Joel
> joel@NSPM.harden-assoc.com
> remove the NSPM. to email me directly
>
>
> '''
> '''
> Public WithEvents ACADApp As AcadApplication ' Use with Application
Event
> Examples
> '''
> ''' using outlook - be sure to go to Tools > References
> ''' and add the Microsoft Outlook library to the project
> '''
> Public oOutlookApp As Outlook.Application
> Public oJournal As Outlook.JournalItem
>
> '''
> ''' declare a couple of variables for managing the journal
> '''
> Private strFilename As String
> 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")
>
> End Sub
> Private Sub ACADApp_EndOpen(ByVal FileName As String)
>
> ''get documents name
> strFilename = ThisDrawing.Name
>
> '' exit if no document name
> If strFilename = "" Then Exit Sub
>
> '' exit if this is a new drawing
> If strFilename Like "Drawing*" Then Exit Sub
>
> '' start a new journal entry
> StartJournal
> End Sub
>
> '''
> ''' start journal - helper routine
> '''
> Private Sub StartJournal()
>
> '' get the outlook application
> Set oOutlookApp = CreateObject("Outlook.Application")
>
> '' create a new journal entry
> Set oJournal = oOutlookApp.CreateItem(olJournalItem)
>
> '' set the category, and start timing
> With oJournal
> .Subject = strFilename
> .Type = "AutoCAD"
> .Save
> End With
> End Sub
>
>
>
>
>
>
0 Likes
Message 4 of 5

Anonymous
Not applicable
Have you loaded acadvba.arx prior to calling your routine?

"Mark Gardiner" wrote in message
news:8CDF18C8FF05CEA7B861845BD66C611F@in.WebX.maYIadrTaRb...
> Yip I have exactly the same thing. I think I read if you issue a command
of
> the name "vba..." it initializes these events I haven't work out how but I
> think you need to use s::startup to get around this
> "Joel Zimmerman" wrote in message
> news:16363F0D73F4668354D28ED92A2979F8@in.WebX.maYIadrTaRb...
> > I have modified Autojournal (from autojournal.net, free source code
> > download) for my use. I simply changed it so that it did not have to
track
> > time of use for each document but merely when a document was opened. I
> will
> > work on the time tracking if I can get this to work.
> >
> > I used the following code with a sub of AcadStartup that merely
> initializes
> > the AcadApplication Events. Everything seems to work fine if I run the
> macro
> > "AcadStartup" at the command line after starting Acad 2000. Every
> following
> > document is logged in the Outlook Journal.
> >
> > My problem is that when I put the line (command "-vbarun" "acadstartup")
> at
> > the end of acad2000.lsp or acad2000doc.lsp the module locks me up. Acad
> acts
> > as though there is a command in process but I cannot do anything. When I
> > type at the command prompt the curser moves over like text is being
typed
> > but nothing appears on screen. I cannot escape out of the command not
> > execute and menu command. When I attempt to exit Acad I am told that a
> > command is in process and I need to exit the command before I can exit
> Acad.
> > I have to force Acad to exit by using the task manager.
> >
> > Here's an even weirder twist. The code is set to skip any "Drawing*"
> > documents as I do not want any new documents logged, only saved
documents
> so
> > when Acad is started with the (command "-vbarun" "acadstartup") in the
> > acad2000doc.lsp it will not
> > lock up until I open another document. So after initially starting Acad
I
> > bring up the vba editor, toggle a breakpoint to follow the code and
then
> > everything works just fine. No lockup! I am at a loss as to how to
> > troubleshoot this. Any Ideas?
> >
> >
> >
> > --
> > Joel
> > joel@NSPM.harden-assoc.com
> > remove the NSPM. to email me directly
> >
> >
> > '''
> > '''
> > Public WithEvents ACADApp As AcadApplication ' Use with Application
> Event
> > Examples
> > '''
> > ''' using outlook - be sure to go to Tools > References
> > ''' and add the Microsoft Outlook library to the project
> > '''
> > Public oOutlookApp As Outlook.Application
> > Public oJournal As Outlook.JournalItem
> >
> > '''
> > ''' declare a couple of variables for managing the journal
> > '''
> > Private strFilename As String
> > 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")
> >
> > End Sub
> > Private Sub ACADApp_EndOpen(ByVal FileName As String)
> >
> > ''get documents name
> > strFilename = ThisDrawing.Name
> >
> > '' exit if no document name
> > If strFilename = "" Then Exit Sub
> >
> > '' exit if this is a new drawing
> > If strFilename Like "Drawing*" Then Exit Sub
> >
> > '' start a new journal entry
> > StartJournal
> > End Sub
> >
> > '''
> > ''' start journal - helper routine
> > '''
> > Private Sub StartJournal()
> >
> > '' get the outlook application
> > Set oOutlookApp = CreateObject("Outlook.Application")
> >
> > '' create a new journal entry
> > Set oJournal = oOutlookApp.CreateItem(olJournalItem)
> >
> > '' set the category, and start timing
> > With oJournal
> > .Subject = strFilename
> > .Type = "AutoCAD"
> > .Save
> > End With
> > End Sub
> >
> >
> >
> >
> >
> >
>
>
0 Likes
Message 5 of 5

Anonymous
Not applicable
Thanks Richard that was just wanted
Mark
"Richard Binning" wrote in message
news:69F01310B43142528E2E9FCE1791AD3F@in.WebX.maYIadrTaRb...
> Have you loaded acadvba.arx prior to calling your routine?
>
> "Mark Gardiner" wrote in message
> news:8CDF18C8FF05CEA7B861845BD66C611F@in.WebX.maYIadrTaRb...
> > Yip I have exactly the same thing. I think I read if you issue a command
> of
> > the name "vba..." it initializes these events I haven't work out how but
I
> > think you need to use s::startup to get around this
> > "Joel Zimmerman" wrote in message
> > news:16363F0D73F4668354D28ED92A2979F8@in.WebX.maYIadrTaRb...
> > > I have modified Autojournal (from autojournal.net, free source code
> > > download) for my use. I simply changed it so that it did not have to
> track
> > > time of use for each document but merely when a document was opened. I
> > will
> > > work on the time tracking if I can get this to work.
> > >
> > > I used the following code with a sub of AcadStartup that merely
> > initializes
> > > the AcadApplication Events. Everything seems to work fine if I run the
> > macro
> > > "AcadStartup" at the command line after starting Acad 2000. Every
> > following
> > > document is logged in the Outlook Journal.
> > >
> > > My problem is that when I put the line (command "-vbarun"
"acadstartup")
> > at
> > > the end of acad2000.lsp or acad2000doc.lsp the module locks me up.
Acad
> > acts
> > > as though there is a command in process but I cannot do anything. When
I
> > > type at the command prompt the curser moves over like text is being
> typed
> > > but nothing appears on screen. I cannot escape out of the command not
> > > execute and menu command. When I attempt to exit Acad I am told that a
> > > command is in process and I need to exit the command before I can exit
> > Acad.
> > > I have to force Acad to exit by using the task manager.
> > >
> > > Here's an even weirder twist. The code is set to skip any "Drawing*"
> > > documents as I do not want any new documents logged, only saved
> documents
> > so
> > > when Acad is started with the (command "-vbarun" "acadstartup") in the
> > > acad2000doc.lsp it will not
> > > lock up until I open another document. So after initially starting
Acad
> I
> > > bring up the vba editor, toggle a breakpoint to follow the code and
> then
> > > everything works just fine. No lockup! I am at a loss as to how to
> > > troubleshoot this. Any Ideas?
> > >
> > >
> > >
> > > --
> > > Joel
> > > joel@NSPM.harden-assoc.com
> > > remove the NSPM. to email me directly
> > >
> > >
> > > '''
> > > '''
> > > Public WithEvents ACADApp As AcadApplication ' Use with Application
> > Event
> > > Examples
> > > '''
> > > ''' using outlook - be sure to go to Tools > References
> > > ''' and add the Microsoft Outlook library to the project
> > > '''
> > > Public oOutlookApp As Outlook.Application
> > > Public oJournal As Outlook.JournalItem
> > >
> > > '''
> > > ''' declare a couple of variables for managing the journal
> > > '''
> > > Private strFilename As String
> > > 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")
> > >
> > > End Sub
> > > Private Sub ACADApp_EndOpen(ByVal FileName As String)
> > >
> > > ''get documents name
> > > strFilename = ThisDrawing.Name
> > >
> > > '' exit if no document name
> > > If strFilename = "" Then Exit Sub
> > >
> > > '' exit if this is a new drawing
> > > If strFilename Like "Drawing*" Then Exit Sub
> > >
> > > '' start a new journal entry
> > > StartJournal
> > > End Sub
> > >
> > > '''
> > > ''' start journal - helper routine
> > > '''
> > > Private Sub StartJournal()
> > >
> > > '' get the outlook application
> > > Set oOutlookApp = CreateObject("Outlook.Application")
> > >
> > > '' create a new journal entry
> > > Set oJournal = oOutlookApp.CreateItem(olJournalItem)
> > >
> > > '' set the category, and start timing
> > > With oJournal
> > > .Subject = strFilename
> > > .Type = "AutoCAD"
> > > .Save
> > > End With
> > > End Sub
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
>
>
0 Likes