LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Automation Events

Hi AA2e72E,
You can do:
Sub Form_Load()
Set xl = CreateObject("Excel.Application")
Set wbk = xl.Workbooks.Add
Set cmd = wbk.VBProject.VBComponents(wbk.Sheets(1).Name).Cod eModule
With cmd
..InsertLines .CountOfLines + 1, "Private Sub Worksheet_Selection" _
& "Change(ByVal Target As Range)"
..InsertLines .CountOfLines + 1, "Call Newx"
..InsertLines .CountOfLines + 1, "End Sub"
..InsertLines .CountOfLines + 1, ""
..InsertLines .CountOfLines + 1, "Sub Newx"
..InsertLines .CountOfLines + 1, "MsgBox ""Hello !"", 64"
..InsertLines .CountOfLines + 1, "End Sub"
End With
xl.Visible = True
End Sub

Regards,
MP

"AA2e72E" a écrit dans le message de
...
In Visual Basic, how do I code this statement, xl.SheetSelectionChange = "Newx"

to trap the selection change event ?

Private Sub Form_Load()
Set xl = CreateObject("Excel.Application")
xl.Workbooks.Add
xl.SheetSelection.Change = "Newx"
xl.Cells(1, 4).Select
End Sub

Sub Newx()
' ... code
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
events? [email protected] Excel Discussion (Misc queries) 1 September 14th 05 03:26 PM
Is there a way to turn events on or off? Angus Comber[_2_] Excel Programming 1 November 6th 03 01:11 PM
events Mark[_17_] Excel Programming 1 October 31st 03 09:18 AM
events Mark[_17_] Excel Programming 1 October 29th 03 12:56 PM
Workbook Events Geoff[_8_] Excel Programming 0 September 13th 03 09:28 AM


All times are GMT +1. The time now is 01:17 PM.

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"