Event triggered in Excel's cell by DDE

A

albertleng

Hi.

I'm trying to trigger an event by using DDE to change a specific cell
in EXCEL.

First, i tested my own code (manually, without DDE) by changing that
cell's (cell B1) value and it worked. The code is as below:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$1" Then
DoSomething
End If
End Sub

However, i tried to use another application and change the cell B1's
value via DDE, that event can't be triggered.

Can anyone give any suggestions? My intention is whever there's a
change in that cell's value, do something.

Thanks a lot.
 
J

Jon Peltier

Link a cell's formula to the DDE cell. It can be as simple as =$B$1. Then
use the Worksheet_Calculate event. This unfortunately doesn't give you the
calculation of a specific cell the way Worksheet_Change does.

- Jon
 
T

Tom Ogilvy

I would expect the change event to fire on a DDE update in xl2000 and later

However, you can also use the Old method of the SetLinkOnData method. See
VBA help for details.
 
A

albertleng

I have solved my problem by Worksheet_Calculate(). This solution will
work as long as i dont have another formula in my excel which my excel
has none of it.

I will try SetLinkOnData when i have spare times.

Anyway, can anyone give any clue for me to try apart from DDE? I heard
of some other way of doing communication between different
application, like OLE automation and etc. Can anyone give some clues
for me to start from there?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top