K
kartune85
I've written out the following code but when I try and reference it
later on in the code, it keeps telling me 'Object Required'.
Sub AddNew()
Dim NewBook As Workbook
Set NewBook = Workbooks.Add
With NewBook
..Title = "Purchase Order"
..Subject = mycount
End With
End Sub
Sub MoveSheet()
ThisWorkbook.Worksheets(1).Move Before:=NewBook.Worksheets(1)
End Sub
When I type in 'NewBook.' it pops up with the menu but when the code
runs it tells me that I require an object.
I was given this code the other day:
Dim NewWB As WorkBook
Set NewWB=Workbook.Add (..../ Workbook.Open (....
I'm not sure what was meant by the code after 'Add'. Does this have
some involvement in referencing the NewWB?
Kartune85
later on in the code, it keeps telling me 'Object Required'.
Sub AddNew()
Dim NewBook As Workbook
Set NewBook = Workbooks.Add
With NewBook
..Title = "Purchase Order"
..Subject = mycount
End With
End Sub
Sub MoveSheet()
ThisWorkbook.Worksheets(1).Move Before:=NewBook.Worksheets(1)
End Sub
When I type in 'NewBook.' it pops up with the menu but when the code
runs it tells me that I require an object.
I was given this code the other day:
Dim NewWB As WorkBook
Set NewWB=Workbook.Add (..../ Workbook.Open (....
I'm not sure what was meant by the code after 'Add'. Does this have
some involvement in referencing the NewWB?
Kartune85