Solved

WScript.Shell and VBA

Posted on 2004-08-02
4
3,274 Views
Last Modified: 2012-06-21
Hi, I have the following script

Dim strMail As String
strMail = "MYNEWNAME"

Set fso = CreateObject("Scripting.FileSystemObject")
Set fsoFile = fso.createtextfile("ByTest.vbs")
fsoFile.writeline "set fso = createobject(""WScript.Shell"")"
fsoFile.writeline "wscript.sleep 5000"
fsoFile.writeline "fso.SendKeys ""{TAB}"", True"
fsoFile.writeline "fso.SendKeys ""{TAB}"", True"
fsoFile.writeline "fso.SendKeys ""{TAB}"", True"
fsoFile.writeline "fso.SendKeys CStr(strMail), True"
fsoFile.Close

this script is working w/o 'fsoFile.writeline "fso.SendKeys CStr(strMail), True" ' . How can I pass the value of the strMail variable in vbs script? I have to mention that just for test purpose the value of strMail is like now, otherwise it is store in Access table.

thanks,
augstef
0
Comment
Question by:augstef
  • 2
  • 2
4 Comments
 
LVL 5

Expert Comment

by:jmacmicking
ID: 11694469
fsoFile.writeline "fso.SendKeys " & CStr(strMail) & ", True"
0
 

Author Comment

by:augstef
ID: 11694660
the strMail has to be in vbs file in this format "MYNEWNAME" and isn't and it's required to be able to use it as sendkeys
0
 
LVL 5

Accepted Solution

by:
jmacmicking earned 50 total points
ID: 11694709
Sorry,
fsoFile.writeline "fso.SendKeys """ & CStr(strMail) & """, True"
Use double quotes to indicate a single quote in the destination string.
0
 

Author Comment

by:augstef
ID: 11694781
great...it's working...thanks a lot
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Cassandra Select Query 1 77
query returning everything 11 106
How to get sum of group by column and sum of total values 4 69
VBA MS Word "Table of Contents" extractor` 4 41
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

777 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