Solved

Using Excel's DDE function--urgent!

Posted on 1998-03-03
6
346 Views
Last Modified: 2008-02-01
I need to use the DDE functions of excel in VB5.
(i.e. DDEIntiat).
The serve is not excel, but is setup like excel.
I am writing a VB5 program to do DDE with it.
0
Comment
Question by:JHBrother
  • 3
  • 2
6 Comments
 
LVL 6

Expert Comment

by:anthonyc
ID: 1458382
Why DDE?
0
 

Author Comment

by:JHBrother
ID: 1458383
I have a piece of instrument (about 4 years old), the manufacture provide a DDE server so I can issue command and get data through DDE.
0
 
LVL 6

Expert Comment

by:anthonyc
ID: 1458384
oh I thought you meant DDE with Excel.....  Excel supports OLE automation which is much better.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:JHBrother
ID: 1458385
The manufacture provided an example, but it was with excel as follows:

ReadChan = DDEInitiate("SRead", "AllData")
DDEExcute ReadChan,"[Openit](9600,2)"
...

I tried to use VB5 to do it, didn't work. It returns 282 (no response". My DDE program can communicate with a different server.



0
 

Accepted Solution

by:
thomaskramer earned 100 total points
ID: 1458386
Don´t know, if i understood you correctly:

This example establishes a DDE link with Microsoft Excel, places some values into cells in the first row of a new worksheet, and charts the values. LinkExecute sends Microsoft Excel the command to activate a worksheet, select some values, and chart them. To try this example, Microsoft Excel must be installed on your computer and in the path statement of your Autoexec.bat file. Paste the code into the Declarations section of a form that has a TextBox control with the default name Text1, and then press F5 and click the form.

Private Sub Form_Click ()
      Dim Cmd, I, Q, Row, Z      ' Declare variables.
      Q = Chr(34)      ' Define quotation marks.
      ' Create a string containing Microsoft Excel macro commands.
      Cmd = "[ACTIVATE(" & Q &"SHEET1" & Q & ")]"
      Cmd = Cmd & "[SELECT(" & Q & "R1C1:R5C2" & Q & ")]"
      Cmd = Cmd & "[NEW(2,1)][ARRANGE.ALL()]"
      If Text1.LinkMode = vbNone Then
            Z = Shell("Excel", 4)      ' Start Microsoft Excel.
            Text1.LinkTopic = "Excel|Sheet1"      ' Set link topic.
            Text1.LinkItem = "R1C1"      ' Set link item.

Text1.LinkMode = vbLinkManual      ' Set link mode.
      End If
      For I = 1 To 5
            Row = I      ' Define row number.
            Text1.LinkItem = "R" & Row & "C1"      ' Set link item.
            Text1.Text = Chr(64 + I)      ' Put value in Text.
            Text1.LinkPoke      ' Poke value to cell.
            Text1.LinkItem = "R" & Row & "C2"      ' Set link item.
            Text1.Text = Row      ' Put value in Text.
            Text1.LinkPoke      ' Poke value to cell.
      Next I
      On Error Resume Next
      Text1.LinkExecute Cmd      ' Carry out Microsoft Excel commands.

MsgBox "LinkExecute DDE demo with Microsoft Excel finished.", 64
   End
End Sub
0
 

Author Comment

by:JHBrother
ID: 1458387
I am not try to DDE with Excel.
I want to DDE with another App and the vender provided an example  with Excel. it uses function like DDEIntiate. So I would like to use those functions.
Maybe I can try to get an OLE with Excel and then less Excel DDE with it?
I will try a few more things
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now