Simple VBA in Excel Userform...

nedved

Member
Join Date
Oct 2007
Location
Kansas
Posts
3
I am a newby to VB in Excel. The only thing I cannot make work is to display string data in a textbox on a userform. I have the following code which appears to work up until the data move from item to the textbox name on the DDERequest line. It generates a type mismatch.

ChannelNumber = Application.DDEInitiate( _
app:="RSLinx", _
topic:="Topic_Test")
CLX_Tag = "Order_No[0]"
TextBox1 = Application.DDERequest(ChannelNumber, CLX_Tag)
Application.DDETerminate ChannelNumber

My goal is to simply create a userform with textboxes in Excel to display string values from a ControlLogix. It seems simple to me, but is it even possible? As I mentioned, I am a bit new to VBA with only some experience programming forms in MS Access.

Any assistance would be greatly appreciated. I've been banging my head on the wall with this for a couple of days now.

Thanks in advance.

Don N.
 
I have not done much VBA in a while but this is was I see:

TextBox1 = Application.DDERequest(ChannelNumber, CLX_Tag)

I think it should be something like this

TextBox1.text = Application.DDERequest(ChannelNumber, CLX_Tag)

This is my first guess. You could also just try to display some text from VBA like

TextBox1.text = "test text"

Get the text working then work on the DDE connection.
 
CharlesM said:
I have not done much VBA in a while but this is was I see:

TextBox1 = Application.DDERequest(ChannelNumber, CLX_Tag)

I think it should be something like this

TextBox1.text = Application.DDERequest(ChannelNumber, CLX_Tag)

This is my first guess. You could also just try to display some text from VBA like

TextBox1.text = "test text"

Get the text working then work on the DDE connection.
OK. I tested the textbox with plain text and it works. But when I try this;

TextBox1.Text = Application.DDERequest(ChannelNumber, CLX_Tag)

I get a VB error - Type mismatch
 
nedved said:
OK. I tested the textbox with plain text and it works. But when I try this;

TextBox1.Text = Application.DDERequest(ChannelNumber, CLX_Tag)

I get a VB error - Type mismatch
I should add that I am using a DINT in the ControlLogix for now.
 

Similar Topics

Hello Friends.... I am trying to read & write the PLC tags through VBA code but not getting correct syntax, i m using FTView SE 6.0 Your help will...
Replies
10
Views
8,266
I'm guessing it's just Monday but I'm having a major brain ****... I have 4 drives that I need to start in any order (i.e. - 1,2,3,4 or 2,3,1,4...
Replies
0
Views
1,382
Hello, I´m having a problem trying to program in Ladder. An output should be trigged by two possible contacts. Take a look on the printscreen...
Replies
5
Views
161
Hello again..trying something on an existing poorly written program and just wanted to double check something system is an A-B MicroLogix 1200 In...
Replies
5
Views
180
Hi all, Writng a FB in ST on Beckhoff TC for a pulser which turns on and off on a cycle, is paused by turning bControlInput to FALSE, but resumes...
Replies
6
Views
271
Back
Top Bottom