Results 1 to 4 of 4

Thread: Select Case Prob [RESOLVED] thx p

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2003
    Posts
    124

    Select Case Prob [RESOLVED] thx p

    I have the following code

    PHP Code:
     Dim KeyAscii As Integer
     KeyAscii 
    Asc(strPath.Chars(0))
    Select Case KeyAscii
           
    Case KeyAscii 67
               cDrive 
    cDrive 1
                
    If bDriveC False Then
                      intStartingY 
    intStartingY 1
                      oSheet
    .Cells(intStartingY7).Value strDriveLetter
                      bDriveC 
    True
                 End 
    If
                 
    oSheet.Cells(intStartingY8).Value cDrive
                 intDriveLocation 
    intDriveLocation 1
           
    Case KeyAscii 68
                
    'similar to above code
           '
    .
           
    '.
           '
    .
           Case 
    KeyAscii90
                 
    'similar to above code

    End Select 

    i cant get the cases to be selected, i've tested with msgbox (KeyAscii) and am sure that the Ascii values are correct.

    any help would be great

    thanks
    Last edited by daveStudent; Jul 15th, 2003 at 11:02 AM.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    One thing you can change in your code to look something like this :

    VB Code:
    1. Dim KeyAscii As Integer
    2.  KeyAscii = Asc(strPath.Chars(0))
    3. Select Case KeyAscii
    4.  
    5.        Case 67
    6.            cDrive = cDrive + 1
    7.             If bDriveC = False Then
    8.                   intStartingY = intStartingY + 1
    9.                   oSheet.Cells(intStartingY, 7).Value = strDriveLetter
    10.                   bDriveC = True
    11.              End If
    12.              oSheet.Cells(intStartingY, 8).Value = cDrive
    13.              intDriveLocation = intDriveLocation + 1
    14.        Case 68
    15.             'similar to above code
    16.        '.
    17.        '.
    18.        '.
    19.        Case 90
    20.              'similar to above code
    21.  
    22. End Select
    Try that .

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    What Pirate is basically saying is that your syntax is incorrect....
    instead of Case KeyAscii = 67, use
    Case 67
    * 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??? *

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jun 2003
    Posts
    124
    yeah i caught that

    thx though

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