Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Per (PeteCresswell):
My playpen (in an MS Access application) includes this code, which succeeds in pushing the desired event routine into "Module1"... but it seems to me like I need it in "ThisWorkbook". I figured it out ("stumbled onto something that seems to work" is probably a more accurate use of the language...). Turns out that even though the sheet I'm creating is named "BBB" by Yours Truly, it's known to the VBA code as "Sheet1" - even after we have explicitly deleted "Sheet1". viz: ================================================== ============= ' --------------------------------------------------- ' Create a workbook and the sheet we are going to ' populate 2020 With mySS 2021 .Workbooks.Add 2022 Set myWS = .Worksheets.Add 2023 End With 2029 myWS.Name = "BBB" ' ------------------------------------------------ ' Remove any default sheets that the user's Excel ' defaults may have created DoCmd.SetWarnings False On Error Resume Next With mySS .Worksheets("Sheet1").Delete .Worksheets("Sheet2").Delete .Worksheets("Sheet3").Delete End With On Error GoTo 0 DoCmd.SetWarnings True ' --------------------------------------------------- ' ATTEMPT TO PUSH SOME EVENT CODE 2410 Set myWB = myWS.Parent 2420 Set myParentModule = myWB.VBProject.VBComponents("Sheet1") 2430 Set myCodeModule = myParentModule.CodeModule 2440 With myCodeModule 2441 .InsertLines .CountOfLines + 1, myCode 2449 End With ================================================== ============= -- PeteCresswell |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Push updates from one workbook to others? | Excel Worksheet Functions | |||
EXCEL: VBE code for a push-down stack (Date,Value1,.....) | Excel Programming | |||
need help with Worksheet_Change code | Excel Programming | |||
Worksheet_Change even code will not run | Excel Programming | |||
Adding Code to the This_workbook module of a created workbook | Excel Programming |