?
Solved

DDE without a control.

Posted on 2004-08-25
4
Medium Priority
?
302 Views
Last Modified: 2010-05-18
I'm trying to create a class module that encapsulates some dde commands that I use to interact with an older program.  However, I need a control like a label or textbox in order to have dde functionality, and as far as I can tell, these cannot be created through code alone.  Passing a reference to such an object works, but is crufty.  

Is there any way to create one of these objects through code alone?  I know you can add to an existing control array, but I want a completely new instance.  I've tried

Dim something as New Label

which gives the error "Invalid use of New keyword".  

Alternatively, is there a way to use DDE that isn't attached to one of these controls?  I've seen http://www.angelfire.com/biz/rhaminisys/ddclient.html commercial DDE classes that seem to do something similar, so it must be possible.
0
Comment
Question by:LastToKnow0
[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
  • 2
  • 2
4 Comments
 
LVL 3

Expert Comment

by:nichia
ID: 11894805
'Adding a control to the form during runtime
Dim myControl As Control
Set myControl = Me.Controls.Add("VB.Label", "myControl")
myControl.Visible = True
myControl.Caption = "DDE Label"
0
 
LVL 1

Author Comment

by:LastToKnow0
ID: 11894926
Is there a way to do this from a class module, or code that is not attached to a form?
0
 
LVL 3

Accepted Solution

by:
nichia earned 1200 total points
ID: 11895094
As far as I know, there is no way to have a Label or TextBox control reside outside a form.

You may have to use the DDE API to do this.

Here is a reference which I will look at now too:

Perform Interprocess Communication
Using the DDE Management Library

http://www.thescarms.com/vbasic/DDEML.asp
0
 
LVL 1

Author Comment

by:LastToKnow0
ID: 11895229
Oy, that looks complicated.  On the other hand, it seems to do exactally what I need.  Thanks.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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…
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…
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…
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…
Suggested Courses

649 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