Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I was wondering why Excel sometimes loose my public variables. I use the variables to have references to my open workbooks and their worksheets. All my workbooks are open. I suppose that when I open a new workbook en hides it, I have to rerun my procedure DCL_Sheets? The problem is that most of the time, everything works fine, but all of a sudden, when I use the reference eg. shSheet22.[A1]="ABC", I get an error and the reason is because wbFile1 is not anymore recognized. Thanks Jos Vens eg. Public wbFile1 as workbook, wbFile2 as workbook Public shSheet11 as worksheet, shSheet12 as worksheet, shSheet21 as worksheet, shSheet22 as worksheet Sub DCL_Sheets set wbFile1 = workbooks("File1.xls") set wbFile2 = workbooks("File2.xls") set shSheet11 = wbFile1.sheets("Sheet01") set shSheet12 = wbFile1.sheets("Sheet02") set shSheet21 = wbFile2.sheets("Sheet01") set shSheet22 = wbFile2.sheets("Sheet02") End sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Set Public Variable on Open | Excel Discussion (Misc queries) | |||
Public variable | New Users to Excel | |||
Scope of Public Variable | Excel Programming | |||
public variable | Excel Programming | |||
Scope of variable includes all Form _and_ Code modules?? | Excel Programming |