Solved

Using Excel's DDE function--urgent!

Posted on 1998-03-03
6
356 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

 

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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

831 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