Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
A simple example
'---------------------------------------------------------------- Sub AddWorkbookEventProc() '---------------------------------------------------------------- Dim StartLine As Long With ActiveWorkbook.VBProject.VBComponents("ThisWorkboo k").CodeModule StartLine = .CreateEventProc("Open", "Workbook") + 1 .InsertLines StartLine, _ "Dim ans" & vbCrLf & _ " ans = Msgbox( ""All OK"",vbYesNo)" & vbCrLf & _ " If ans = vbNo Then myVar = True" End With End Sub -- HTH Bob Phillips (remove xxx from email address if mailing direct) wrote in message oups.com... I'm trying to, I suppose for want of a better description, paste a WorbookOpen sub-routine into 'ThisWorkbook' component of a project in a new workbook. Basically I use shell files that refresh data from Access/Oracle tables, add any necessary formatting, then copy an array of sheets to a new workbook. I have since created some additional code that allows me to track who opens these final reports and the frequency. I have no trouble importing my .bas file, however adding the code to ThisWorkbook to call the sub-routine on WorkbookOpen is causing issues. Can anyone assist? MT |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
adding a "relationship code" to a worksheet | Excel Worksheet Functions | |||
Adding data only if adjacent to cell labeled "male"/"female" | Excel Worksheet Functions | |||
Adding "and" to Spellnumber code | Excel Discussion (Misc queries) | |||
Unprotecting 4 sheets before "WorkbookOpen" macro runs | Excel Discussion (Misc queries) | |||
Adding "New" "Insert" "Delete" into a workbook to change from data 1 to data 2 etc | Excel Programming |