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

I searched Excel and missed it. Found it in VBA.

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


"Chip Pearson" wrote in message
...
Jim,

What version of Excel are you using? In 2002, searching for 'scope'

brings
up the topic 'Understanding Scope And Visibility', which it the topic you
want.


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




"Jim Carlock" wrote in message
...
Heh, Thanks Chip. "scope" isn't in the index and is NOT found when
searched for.

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