?
Solved

WScript.Shell and VBA

Posted on 2004-08-02
4
Medium Priority
?
3,296 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
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...
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
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…

741 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