Solved

Using Excel's DDE function--urgent!

Posted on 1998-03-03
6
371 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

695 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