View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default ThisWorkbook variables...

Jim,

The variable strPath will retain its value as long as the workbook is open,
or an End statement is executed, or VBA resets the VBProject due to your
editing code.

explains the lifetime of objects/variables?


See "scope" in the VBA Help.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com


"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!