Menu

Realterm v3 - PutString second parameter in excel

Oliver
2015-04-27
2015-05-21
  • Oliver

    Oliver - 2015-04-27

    Hello, i want to use Realterm v3 to send raw data (hex) from excel to the serial port. For that i thought i could use the PutString(String, SendAs) function introduced with v3. But i got an syntax error in excel/vba when using this function with the second parameter. I need this parameter to send numeric raw data (not ascii).

    Please, can anyone help me?

     
  • Oliver

    Oliver - 2015-04-29

    Does no one has the same problem like me? I am using excel 2010 on a win7 machine.
    Have I something to do, to use the new functionality introduced with v3. When I call the function like RT.PutString(12345) it works, but the string is send in ascii. I need raw data.

     
  • Simon Bridger

    Simon Bridger - 2015-04-30

    Not giving any clues about what you actually did are you....(hint actual code tried)

    The second param is an enumPutStringAs - do you have a valid value for it?

     
  • Oliver

    Oliver - 2015-05-08

    Hey sorry here is my excel vba code:


    Public RT As Object

    Sub Schaltfläche1_Klicken()
    Set RT = CreateObject("Realterm.RealtermIntf")
    RT.Caption = "CONTROLLED FROM EXCEL"
    RT.Port = 2
    RT.Baud = 230400
    RT.portopen = True
    RT.SelectTabSheet ("Port")
    RT.Visible = False
    End Sub

    Sub Schaltfläche4_Klicken()
    If Not RT Is Nothing Then RT.Close
    Set RT = Nothing
    End Sub

    Sub Schaltfläche6_Klicken()
    RT.Putstring(Cells(1, 1), 2)
    End Sub

    Important is the command

    RT.Putstring(Cells(1, 1), 2)

    When i click the button i got an Syntax error in this line.
    What can i do?

     
  • Oliver

    Oliver - 2015-05-18

    Please can anyone try this code above and give me a feedback?

     
  • Simon Bridger

    Simon Bridger - 2015-05-19

    Not even having excel, I suggest CELLS might be the offending part.
    The fact you are getting syntax error suggests to me it is nothing to do with Realterm, and entirely excel syntax that is wrong.

    What does RT.Putstring("A string", 2) do?
    (BTW you need to say which exact version you are using)

    Also the second param is an enumertion. I don't know if VBA wants to use the number or the actual enum name:

    EnumPutStringAs = TOleEnum;
    const
    saLiteral = $00000000;
    saASCII = $00000001;
    saNumbers = $00000002;

     

    Last edit: Simon Bridger 2015-05-19
  • Simon Bridger

    Simon Bridger - 2015-05-19

    Ron writes.....

    I agree it is likely a syntax issue; and in VBA, there should be no difference between using the enumeration name vs the value.

    I don't know if this is his only problem without testing, but he should try changing:

    RT.Putstring(Cells(1, 1), 2)    
    

    to

    RT.Putstring Cells(1, 1), 2 
    

    The first form is generally used when the method is returning a value. Since there is no Var = (left side of formula), the syntax is incorrect.

    Ron

     

    Last edit: Simon Bridger 2015-05-19
  • Anonymous

    Anonymous - 2015-05-20

    Indeed, that was the mistake.
    Using RT.Putstring Cells(1, 1), 2 solves the problem.
    Thanks!

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB