Solved

DDE without a control.

Posted on 2004-08-25
4
282 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
  • 2
  • 2
4 Comments
 
LVL 3

Expert Comment

by:nichia
Comment Utility
'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
Comment Utility
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 300 total points
Comment Utility
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
Comment Utility
Oy, that looks complicated.  On the other hand, it seems to do exactally what I need.  Thanks.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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 …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

763 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

12 Experts available now in Live!

Get 1:1 Help Now