Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Get string from textfile, then compare it to another string

Posted on 2001-08-10
1
Medium Priority
?
179 Views
Last Modified: 2010-05-18
Hi all!

I have a strange problem. Here's the code.
Private Sub cmdTest_Click()
Open "c:\thomas" For Input As #1 ' file opened for reading
   
    'While Not EOF(1)
        Line Input #1, instring1
        Line Input #1, instring2
        Line Input #1, instring3
        Line Input #1, instring4
        Line Input #1, instring5
    'Wend
Close #1
'MsgBox instring1 & vbCrLf & instring2 & vbCrLf & instring3 & vbCrLf & instring4 & vbCrLf & instring5
scriptlang.RunCommand instring1, instring2, instring3, instring4, instring
End Sub


When I run the sub Scriptlang.RunCommand (here's the code):

Public Sub RunCommand(Command2Run, Syntaxx1, Syntaxx2, Syntaxx3, Syntaxx4)        'Runs the command u ask for
    If Command2Run = "RegDelete" Then RegDelete Syntaxx1, Syntaxx2
    If Command2Run = "RegSetKey" Then RegSetKey Syntaxx1, Syntaxx2, Syntaxx3, Syntaxx4
    If Command2Run = "FileDelete" Then FileDelete Syntaxx1, Syntaxx2
    If Command2Run = "SendMSG" Then SendMSG Syntaxx1
End Sub

It does not evaluate the string Command2Run to be the same as the one on the other side of the = sign.

When I try to use RegSetKey, the value of instring1 is "RegSetKey", and the value of Command2Run is also "RegSetKey". BUT when it compares the string Command2Run with "RegSetKey" it doesn't think it's the same???!

Please help =)

/Thomas
0
Comment
Question by:thomas77
1 Comment
 
LVL 11

Accepted Solution

by:
Otana earned 400 total points
ID: 6372537
Try this:

If Ucase(Trim(Command2Run)) = Ucase(Trim("RegSetKey")) Then RegSetKey Syntaxx1, Syntaxx2, Syntaxx3, Syntaxx4
   
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question