Solved

Using Excel's DDE function--urgent!

Posted on 1998-03-03
6
350 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB 6.0 printer how to align 6 58
Best way to parse out a json string in VB6? 10 111
Access query that references subform 5 43
Macro Excel - Multiple If conditions 2 63
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 …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

912 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

18 Experts available now in Live!

Get 1:1 Help Now