Results 1 to 3 of 3

Thread: Can t get VB to send [return]

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Location
    NW
    Posts
    1

    Angry Can t get VB to send [return]

    The following code works for all except (R) which should send a return to the program ........

    Open Jobname For Input As #1
    Do While Not EOF(1)
    Input #1, varcheck
    Sleep (10000)
    If varcheck = "(K)" Then
    Input #1, FPath
    If FPath = "C:\MAR" Then
    FPath = "C:\MA" & Format(jdate, "YY") & Format(jdate, "MM") & Format(jdate, "DD") & ".MAR"
    End If
    Kill FPath

    'the following should send a return
    ' after reading (R)
    ' to the program but it just hangs up
    ' works OK for all other codes
    ElseIf varcheck = "(R)" Then
    Sendkys Chr$(13)
    ElseIf varcheck = "(P)" Then
    Input #1, TLength
    Sleep TLength
    ElseIf varcheck = "(S)" Then
    Sendkys VK_SPACE
    ElseIf varcheck = "(D)" Then
    Sendkys (Format(jdate, "DDMMYY"))
    ElseIf varcheck = "(A)" Then
    Sendkys (Format(jAdd, "DDMMYY"))
    ElseIf varcheck = "(T)" Then
    Sendkys (Format(Date, "DDMMYY"))
    ElseIf varcheck = "(C)" Then
    Input #1, FPath
    If FPath = "C:\MAR" Then
    FPath = "C:\MA" & Format(jdate, "YY") & Format(jdate, "MM") & Format(jdate, "DD") & ".MAR"
    startwait = Timer
    Do While Timer < startwait + 2700
    DoEvents

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    1) Goto http://msdn.microsoft.com and search for SendKeys -- I know there's some specific code needed to send a return
    2) You're more likely to get help faster by say JUST WHAT THE PROBLEM is.... nothing annoys people here than posts that simply say "It doesn't work." What do mean it the "(R)" doesn't work... what does happen?
    3) Format your code using [ vbcode] and [ /vbcode] (w/o the spaces) it'll look nicer and people can read it.
    4) You can also do a search on the forums.... I know there are several threads on SendKeys
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    Addicted Member PhilRob56's Avatar
    Join Date
    Oct 2002
    Location
    New York
    Posts
    249
    To send the Enter Key (or any key that does not display a character when pressed) you must use specific syntax.

    Enter is sent as {ENTER} or ~

    See MSDN for a full discussion on the subject.
    Some days you're the dog,
    and some days you're the hydrant.


    VB6 Enterprise

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width