Quote Originally Posted by LaVolpe View Post
Well, one more shot & I think you should be able to adapt the following example to your needs.
I assume you want to use the same server form for multiple ticker symbols by changing the server form's LinkTopic. Unsure if it is possible, but you can create a form for each ticker, dynamically.

I. DDE Server - New project
1. On Form1, add 1 command button
2. Add new form & add 2 textboxes there. Name one of them LAST and the other BID
3. On that new form, change LinkMode property to: 1
4. Paste this code in Form1
Code:
Option Explicit

Private Sub Command1_Click() ' example loading 2 forms for 2 tickers
    Dim f As Form2
    Set f = New Form2 
    With f
        f.LinkTopic = "DELL" ' client link topic
        f.LinkMode = 1
        f.Last.Text = "DELL 'Last' Field" ' sample data
        f.Bid.Text = "DELL 'Bid' Field" ' sample data
    End With
    Set f = New Form2
    With f
        f.LinkTopic = "MSFT" ' client link topic
        f.LinkMode = 1
        f.Last.Text = "MSFT 'Last' Field" ' sample data
        f.Bid.Text = "MSFT 'Bid' Field" ' sample data
    End With
    Command1.Enabled = False
End Sub

Private Sub Form_Load()
    Command1.Caption = "Load Tickers"
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Dim f As Variant
    For Each f In Forms
        If Not f Is Me Then Unload f
    Next
End Sub
II. DDE Client
1. New project, add 2 textboxes and 2 command button. Leave all default named
2. Add this code to the form
Code:
Option Explicit

Private Sub Form_Load()
    Command1.Caption = "MSFT"
    Command2.Caption = "DELL"
End Sub

Private Sub Command1_Click()
    With Text1
        .LinkItem = "LAST" ' name of server's text box
        .LinkTopic = "Project1|MSFT" ' rename Project1 to Server's eventual EXE name
        .LinkMode = vbLinkAutomatic
    End With
    With Text2
        .LinkItem = "BID" ' name of server's text box
        .LinkTopic = Text1.LinkTopic
        .LinkMode = vbLinkAutomatic
    End With
End Sub

Private Sub Command2_Click()
    Text1.LinkTopic = "Project1|DELL" ' rename Project1 to Server's eventual EXE name
    Text2.LinkTopic = Text1.LinkTopic
    Text1.LinkMode = vbLinkAutomatic ' changing linktopic breaks connection, re-connect
    Text2.LinkMode = vbLinkAutomatic
End Sub
III. Example
1. Run the server & click the command button
2. Run the client. Click the command buttons as desired
Thanks buddy for your help. Infact to be honest, I did exactly the same thing before I read your post.

I created a form and then created multiple instances of that form and set link topic at runtime. The link mode was already source so there was no problem. It's working. I appreciate your help.

Just on other note, can I loop between those normal forms (not child) thru a code. For eg in a way for each x form in totalforms. x=this form and so on.