Results 1 to 4 of 4

Thread: Is there a way to make a string received into a command?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Carolina, Puerto Rico, USA
    Posts
    227
    Is there a way to make a string contained in a variable into a command, for example, is the string contains End, the program stops?


    Thanks for the time!
    NievesJ

  2. #2
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    Yes, use this code:
    Code:
    '------------------------------------------
    '   (c) 1999 Trigeminal Software, Inc.  All Rights Reserved
    '------------------------------------------
    'Thanks to ----------michka - Michael Kaplan
    'Rest of code by Sergio Perciballi -oigres P (Aug-6-2000)
    'Email: oigres@postmaster.co.uk
    'Uses the function used by the immediate window
    'to execute a line of code.
    Option Compare Text
    Option Explicit
    
    Private Declare Function EbExecuteLine Lib "vba6.dll" _
            (ByVal pStringToExec As Long, ByVal Foo1 As Long, _
            ByVal Foo2 As Long, ByVal fCheckOnly As Long) As Long
    
    ' For VB5 IDE
    'Declare Function EbExecuteLine Lib "vba5.dll" _
     (ByVal pStringToExec As Long, ByVal Foo1 As Long, _
     ByVal Foo2 As Long, ByVal fCheckOnly As Long) As Long
    
    ' FOR Access 97/VBE.dll clients like Word 97 and Excel 97
    'Declare Function EbExecuteLine Lib "vba332.dll" _
     (ByVal pStringToExec As Long, ByVal Foo1 As Long, _
     ByVal Foo2 As Long, ByVal fCheckOnly As Long) As Long
    
    Function FExecuteCode(stCode As String, _
                Optional fCheckOnly As Boolean) As Boolean
    
        FExecuteCode = EbExecuteLine(StrPtr(stCode), 0&, 0&, Abs(fCheckOnly)) = 0
    End Function
    Usage:
    Code:
    FExecuteCode "End"
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Carolina, Puerto Rico, USA
    Posts
    227
    Woah!!, thanks that work great!!
    NievesJ

  4. #4
    Addicted Member
    Join Date
    Sep 2000
    Posts
    219
    Cool man.

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