View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Jim Carlock[_2_] Jim Carlock[_2_] is offline
external usenet poster
 
Posts: 33
Default ThisWorkbook variables...

Something is seriously wrong with my help. Oof, I need to find where
the VBA help file is. Excel seems to be a separate giberish item.

--
Jim Carlock
http://www.microcosmotalk.com
Feel free to post back to the newsgroup!


"Chip Pearson" wrote in message
...
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!