Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Create a new workbook, then start VB and paste the following code into a
new code module. Close VB. Run the macro from Excel. The macro runs correctly, yet VB reopens. Is there a way to either keep VB from opening or a programmatic way to close it after it does? Thanks for the help! Bob __________________________________________________ ___ Sub test() Dim SheetName As String SheetName = "XYZZY" Set WS = ActiveWorkbook.Sheets.Add WS.Name = SheetName ' For i = 1 To ThisWorkbook.VBProject.VBComponents.Count Set c = ThisWorkbook.VBProject.VBComponents(i) If c.Type = 100 Then 'vbext_ct_document =100 If c.Properties("Name") = SheetName Then ThisWorkbook.VBProject.VBComponents(i).Properties( "_CodeName") = SheetName End If Next i Set c = Nothing ' With ActiveWorkbook.VBProject.VBComponents(SheetName).C odeModule StartLine = .CreateEventProc("Change", "WorkSheet") + 1 .InsertLines StartLine, "Call OnPTSelectionChange" End With End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formula To Bring The Best Name | Excel Worksheet Functions | |||
How do you bring up the calculator? | Excel Worksheet Functions | |||
Bring to Front | Excel Discussion (Misc queries) | |||
Formula to bring up to # but not over | Excel Discussion (Misc queries) | |||
bring up list | Excel Worksheet Functions |