View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default Program Control After Closing Another Program

Hi Steve,

Without know exactly whatt the called routines are doing I cannot be sure
that this will answer your question but I suspect that VBA does not know
which workbook etc it should be referring to.

Declare some Public variables (at the top of a standard module in the
Declarations area) and then set the variables to the desired workbooks. Then
use the variables to refer to the desired workbook in your code.

Declare the following Public variables in a standard module
Public wbThis As Workbook
Public wbOpened As Workbook


Set wbThis = ThisWorkbook
Set wbOpened = Workbooks.Open("Shelf Locations.xls")

'Examples of using the workbook variables
wbOpened.Activate
wbOpened.Sheets("Sheet2").Activate


--
Regards,

OssieMac