Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

WScript.Shell and VBA

Posted on 2004-08-02
4
Medium Priority
?
3,302 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Recently I was talking with Tim Sharp, one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. While doing some quick training with some of the Percona team, Tim brought something to my attention...
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

604 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