View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
broro183[_152_] broro183[_152_] is offline
external usenet poster
 
Posts: 1
Default Macro - New Workbook


hi Goaliemenace

Here are two examples of how you can set a variable to be a workbook.
The first is when you open an existing file & the second is if you are
create a file...



VBA Code:
--------------------


Option Explicit
Sub Macro2()
Dim Createdwb As Workbook
Set Createdwb = Workbooks.Open(Filename:="blah.xls")
'or
Set Createdwb = Workbooks.Add
'other code, eg...
Createdwb.activate
'free memory
Set Createdwb = Nothing
End Sub

--------------------




hth
Rob


--
broro183

Rob Brockett. Always learning & the best way to learn is to
experience...
------------------------------------------------------------------------
broro183's Profile: 333
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=180996

Microsoft Office Help