View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Damon Longworth[_3_] Damon Longworth[_3_] is offline
external usenet poster
 
Posts: 23
Default Create a newworksheet with VBA code and put VBA code in the ne

Yes, it is possible. Follow the link provided by Norie for instructions. Read
the whole page so you have a good understanding of the pros and cons of
writing code with code.

I personally, will create a template with the code already present and then
add data to this template with code. I prefer the K.I.S.S. principle.

"mp112849" wrote:

Damon, will this work if you want to copy code into the "ThisWorkbook"
module of a second workbook? In other words, here's a scenario...

I have a workbook open, call it WorkBookA. I open another existing
workbook programatically or with file/open, call it WorkBookB. Can I
copy code from the ThisWorkbook module of WorkBookA to the ThisWorkBook
module of WorkBookB? Can this code be an overwrite of an existing
method in WorkBookB, say a pre-existing ThisWorkbook sub like:

Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal
Target As Range, Cancel As Boolean)
.... code goes here
End Sub