Solved

Get string from textfile, then compare it to another string

Posted on 2001-08-10
1
154 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 100 total points
ID: 6372537
Try this:

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

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Run code from text file in vb 1 64
using web browser with BING 40 120
MsgBox 4 59
Need Nag Screen for Reboot if system up time is over 14 days 12 47
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

770 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