View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
SB SB is offline
external usenet poster
 
Posts: 4
Default Using VBA to Write VBA code

I have John Walkenbach's book "Excel 2002 Power Programming with VBA"
and was using the section entitled Using VBA to Write VBA code (pg
797). Unfortunately the code I have entered is not working and I
think it is because of the fact that I have excel 2000 (but I'm not
sure). The line of code which is causing the error is the first one in
the following section

With ActiveWorkbook.VBProject. _
VBcomponents(shtNewNotesSheet.Name).CodeModule
nextline = .CountOfLines + 1
.InsertLines nextline, Code
End With

(where nextline is a numeric variable (dim as double) and where Code
is a string variable which contains the VBA code I wish to insert into
the worksheet)

Is the "VBComponents()" element a new property of the VBProject object
(ie in excel 2002 but not excel 2000)??

If so how can I use VBA to write VBA in excel 2000?

Thanks in advance