Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.
.sendkeys variable in VBS
Name: Chris Crash Date: July 6, 2009 at 08:58:01 Pacific OS: Windows Vista Subcategory: General
Comment:
I am working on a small VBS script that is *supposed* to enter a user defined variable into excel. What happens istead is that it opens excel and then says there is a problem. When I did not put a variable in, it typed the word in. I need to no how to make the shellobj.sendkeys command work with variables. Here is my code:
DIM userInput set shellobj = CreateObject("WScript.Shell") name = inputbox("Please Enter Your Name") shellobj.run "cmd" wscript.sleep 500 shellobj.sendkeys "start excel.exe{enter}exit{enter}" wscript.sleep 3000 shellobj.sendkeys "{& name &}{enter}"
the error message that pops up says Line: 8 Char: 1 Error: invalid procedure call or argument.
But when I change the shellobj.senkeys "{& name &}{enter}" to shellobj.senkeys "john{enter}" , it works. Please help.
Summary: Is it possible to use user/system environment variables in VB? I'm integrating a batch file into a VB program. The batch is writing to: %temp%\tmp.tmp so I'm wondering if there's a way I can open that...
Summary: Is there a way to set system environment variables in vb. I see the class environ to view them, but what if I want to set them? thanks, Alex ...
Summary: I am writing a software program in VB 6.0 that accepts input from a user and stores it to an Access database - both text and numeric. How do I declare the variables for these items. For instance, I ha...