View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Declaring Variables

or

strWkBkName = Activeworkbook.Name

or

strWkBkName = ThiwWorkbook.Name

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"pikus " wrote in message
...
Well if you want the variable to hold the NAME of the workbook:

Dim strWkBkNam As String
strWkBkNam = "Workbook.xls"

BUT, if you want the variable to be an object reference to the workbook
itself:

Dim WkBk1 As Workbook
Set WkBk1 = Workbooks("Workbook.xls")

Note the use of the "Set" keyword. This must always be used with
object variables. - Pikus


---
Message posted from http://www.ExcelForum.com/