View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default set a workbook variable

I would set the path/filename to a string and then set the workbook name
after it is opened:

Sub Macro1()
Dim s As String
Dim wb As Workbook
s = "C:\test\beta.xls"
Workbooks.Open Filename:=s
Set wb = ActiveWorkbook
MsgBox (wb.Name)
MsgBox (wb.Path)
End Sub
--
Gary''s Student - gsnu200902


"dstiefe" wrote:

I would like to set my variable "wb" to a workbook object

so something like this

dim wb as workbook

set wb = ????

I would like to set the variable "wb" to a workbook that is not open and in
a different folder...can i do that?