assume you mean
Private Sub Workbook_Open()
strPath = ThisWorkbook.Path
End Sub
Rather than ThisWorkbook_Open
-------
the lifetime is the lifetime of the open workbook.
It is explained in Excel VBA help.
In help, look for variables, then lifetime:
A module-level variable differs from a static variable. In a standard module
or a class module, it retains its value until you stop running your code. In
a class module, it retains its value as long as an instance of the class
exists. Module-level variables consume memory resources until you reset
their values, so use them only when necessary.
the thisworkbook exists for as long as the workbook is open.
Perhaps this is just an example, but why not use Thisworkbook.Path directly.
--
Regards,
Tom Ogilvy
Jim Carlock wrote in message
...
Option Explicit
Private strPath As String
Private Sub ThisWorkbook_Open()
strPath = ThisWorkbook.Path
End Sub
What's the lifetime of strPath? There a reference anywhere that
explains the lifetime of objects/variables?
--
Jim Carlock
http://www.microcosmotalk.com
Feel free to post back to the newsgroup!