Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
Im creating references/variables to other worksheets in other workbooks but they dont work when returning to the original workbook sheet. Run time error 91: Object variable or With block variable not set The two workbooks are loaded at one time and in the first/main (WTNSystem.xls) there is a module containing: Public WSS As Worksheet, WSC As Worksheet, WSD As Worksheet, WSO As Worksheet Public Sub Auto_Open() ChDir ("D:\My Documents\Excel\Calc") Workbooks.Open Filename:="WTNDatabase.xls" Set WSS = Workbooks("WTNSystem").Worksheets("System") Set WSC = Workbooks("WTNSystem").Worksheets("Calculation") Set WSD = Workbooks("WTNDatabase").Worksheets("Database") Set WSO = Workbooks("WTNDatabase").Worksheets("Offers") WSS.Activate End Sub The second workbook is opened and everything works fine as long as I stay within the main workbook and I can switch to the WTNDatabase.xls workbook but returning to WTNsystem.xls with the code: WSC.Activate triggers the error. I even put the same code as above in the WTNDatabase.xls , but it doesnt help!!! I cannot switch back to WTNSystem.xls with this abbreviation. Why? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Variables in links and external file references | Links and Linking in Excel | |||
Webqueries and variables problem | Excel Programming | |||
Can I use variables for workheet name references in Excel functions? | Excel Discussion (Misc queries) | |||
Can I use variables for workheet name references in Excel functions? | Excel Worksheet Functions | |||
another look-up problem(three variables) | Excel Programming |