Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Run a macro based on event

I would like to run a macro based on an event either by calling it from a cell based on an value change (DDE request is monitoring a status word; seconds on a clock) or by setting up an time delay that calls a macro every minute or so

Any idea what the syntax/solution would be for this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Run a macro based on event

Apparently, a DDE change does not trigger a change event. I think that you
have to link other cells to your DDE Cells so that they also get updated
when DDE updates, but triggering the event.

Can you try something else? Link say Z4:Z10 to I4:I10, each one in turn,
where I4:I10 are the DDE cells.

Then use this event code

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("Z4:Z10")) Is Nothing Then
With Target
If .Value < "" Then
.offset(0, -16).Value = Format(Now, "dd mmm yyyy hh:mm:ss")
End If
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub

What I am trying is to force the DDE updates to also update the range
Z4:Z10. This will (might?) trigger the change event, and we trap the
secondary range, and insert the date from there. I can't test it as I don't
have the DDE updates.



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Bret" wrote in message
...
I would like to run a macro based on an event either by calling it from a

cell based on an value change (DDE request is monitoring a status word;
seconds on a clock) or by setting up an time delay that calls a macro every
minute or so.

Any idea what the syntax/solution would be for this?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Run a macro based on event

Just to add to Bob's advice,

Linking cells will trigger the calculate event, not the change event.

DDE will trigger the change event in Excel 2000 and later to the best of my
knowledge and experience.

the SetLinkOnData method will assign a macro to fire for a specific DDE
link. This should work for xl5 and later

If you want to trigger at spaced intervals look at Chip Pearson's page

http://www.cpeason.com/excel/ontime.htm

--
Regards,
Tom Ogilvy



"Bob Phillips" wrote in message
...
Apparently, a DDE change does not trigger a change event. I think that you
have to link other cells to your DDE Cells so that they also get updated
when DDE updates, but triggering the event.

Can you try something else? Link say Z4:Z10 to I4:I10, each one in turn,
where I4:I10 are the DDE cells.

Then use this event code

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("Z4:Z10")) Is Nothing Then
With Target
If .Value < "" Then
.offset(0, -16).Value = Format(Now, "dd mmm yyyy

hh:mm:ss")
End If
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub

What I am trying is to force the DDE updates to also update the range
Z4:Z10. This will (might?) trigger the change event, and we trap the
secondary range, and insert the date from there. I can't test it as I

don't
have the DDE updates.



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Bret" wrote in message
...
I would like to run a macro based on an event either by calling it from

a
cell based on an value change (DDE request is monitoring a status word;
seconds on a clock) or by setting up an time delay that calls a macro

every
minute or so.

Any idea what the syntax/solution would be for this?





Reply
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
Creating calendar that autopopulates dates based on event date ent TxKarateMama Excel Worksheet Functions 1 February 3rd 09 04:22 PM
Hiding rows based on a criteria thru and event proceedure realmani Excel Worksheet Functions 2 September 7th 07 10:35 AM
Event Macro running another macro inside K1KKKA Excel Discussion (Misc queries) 1 December 20th 06 08:21 PM
Clear Cell based on event w/o macro? Paul987 Excel Worksheet Functions 2 October 27th 05 08:44 PM
Triggering an event based on reference Supriya Excel Programming 0 January 29th 04 11:50 AM


All times are GMT +1. The time now is 10:31 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"