Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Anyone knows why this does not work - i.e. the even sink
excel_SheetChange never fires? Dim myExcel,myWorkbook,mySheet Set myExcel=WScript.CreateObject("Excel.Application"," excel_") Set myWorkbook=myExcel.Workbooks.Add() Set mySheet=myWorkbook.Sheets(1) myExcel.Visible=TRUE myExcel.EnableEvents=TRUE While myExcel.Visible WScript.Sleep(100) Wend Sub excel_SheetChange(ByVal Sh, ByVal Target) WScript.Echo "Sheet Change: Sheet=" & Sh.Name & ", Range=" & Target.Row & "," & Target.Column End Sub Any help welcome. If I get this to work I'll be posting about it on my blog. I've been wanting to sink Excel events to vbscript for ages and just don't seem to be able to manage :( Thanks! AJ -- http://nerds-central.blogpot.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
1) Make sure the worksheet_change function is on the VBA sheet where you want
it to work. Work_sheet change fucntion only works on one sheet 2) Worksheet_change get only one parameter, not two 3) To get the sheetname use activesheet Sub worksheet_Change(ByVal Target As Range) MsgBox "Sheet Change: Sheet=" & ActiveSheet.Name & _ ", Range=" & Target.Row & "," & Target.Column End Sub "Alex Turner" wrote: Anyone knows why this does not work - i.e. the even sink excel_SheetChange never fires? Dim myExcel,myWorkbook,mySheet Set myExcel=WScript.CreateObject("Excel.Application"," excel_") Set myWorkbook=myExcel.Workbooks.Add() Set mySheet=myWorkbook.Sheets(1) myExcel.Visible=TRUE myExcel.EnableEvents=TRUE While myExcel.Visible WScript.Sleep(100) Wend Sub excel_SheetChange(ByVal Sh, ByVal Target) WScript.Echo "Sheet Change: Sheet=" & Sh.Name & ", Range=" & Target.Row & "," & Target.Column End Sub Any help welcome. If I get this to work I'll be posting about it on my blog. I've been wanting to sink Excel events to vbscript for ages and just don't seem to be able to manage :( Thanks! AJ -- http://nerds-central.blogpot.com |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Click event on menu item is lost after first time firing of the event | Excel Programming | |||
Event macro firing twice | Excel Programming | |||
Workbook_Open event not firing | Excel Programming | |||
Event sometimes stops firing? | Excel Programming | |||
OnTime event not firing in Workbook_Open event procedure | Excel Programming |