LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Why does this bring up VB?

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula To Bring The Best Name peterh Excel Worksheet Functions 2 January 20th 10 05:38 AM
How do you bring up the calculator? HAPPY Excel Worksheet Functions 3 November 16th 08 08:20 PM
Bring to Front Chuck Excel Discussion (Misc queries) 0 November 8th 06 04:50 PM
Formula to bring up to # but not over Woody13 Excel Discussion (Misc queries) 3 October 17th 06 08:44 PM
bring up list DarnTootn Excel Worksheet Functions 2 April 19th 06 03:43 PM


All times are GMT +1. The time now is 07:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"