I am playing with vba at the moment and required a bit of a explanation
about techniques
What i was trying to achieve was from workbook, run code to open up another
workbook on the network
Select the workbook
Check if a worksheet already exists - if not create a template sheet from
the same book and name it appropriately
Then close it returning some item to the current workbook
So my code so far
Dim wbook as Object, wsheet As Object
Set wBook = Workbooks()
With wBook
.Open filename:=str_sbodirectory & str_sbofilename
Set wSheet = wBook.Sheets(str_sboworksheetdate).Select
'str_sboworksheet is a dynamic string which set the sheet name as the
current month and the year ie JUN 08
If wSheet Is Nothing Then
Worksheets("Master").Copy Before:=Master
End If
End With
Now first lack of understanding is the wbook being declared as a object, i
cant seem to manipulate the wbook its open.. is it because of declaring it
as an object instead of workbook
Then i cant seem to get any wsheet function to work and always coming with
subscript out of a range.
I wanted to try and refer by wookbook and worksheet as i will have 3
workbook open at the same time.. how should i approach this
I think i need more on the understanding of why.. rather than do this.. so
if you could point me in the right direction and where my logical approach
is going wrong.