| Author |
Topic |
|
lawash44
Starting Member
5 Posts |
Posted - 2006-10-04 : 08:52:00
|
| On SQL SERVER 2000 ActiveX script task in VBScriptWhy this script returns a runtime error Function Main()Dim ObjShellDim IntReturn Set objShell = CreateObject("Wscript.Shell") IntReturn = objShell.Run("c:\program files\microsoft office\office11\Excel.exe", 1, TRUE) Main = DTSTaskExecResult_SuccessEnd FunctionExcel is located at this folderThanks |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2006-10-04 : 09:02:59
|
| Ok, I'm confused...why would one want to run excel from a vbscript?? What is the error message?--Lumbago"Real programmers don't document, if it was hard to write it should be hard to understand" |
 |
|
|
lawash44
Starting Member
5 Posts |
Posted - 2006-10-04 : 09:16:26
|
| My final script will be :'**********************************************************************' Visual Basic ActiveX Script'************************************************************************Function Main()Dim ObjShellDim IntReturn Set objShell = CreateObject("Wscript.Shell") IntReturn = objShell.Run("c:\program files\microsoft office\office11\Excel.exe d:\dts_end.xls", 0, TRUE) Main = DTSTaskExecResult_SuccessEnd FunctionI want to run an excel application in hidden modeThis excel file contains a macro that will send a DDEPOKE to an application supervisor (Monitor Pro).As I hav'nt find how to modify a value in my supervisor with DDE in a DTS Package, I try by this way.When i lauch my vbscript the error is : "ActiveX Scripting encountered a Run TIme Error during the execution of the script"Thanks |
 |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2006-10-04 : 09:37:13
|
| Are you sure that the user running this script has operating system permissions?As I can see this is a pure operating system command...I'd suggest you select Execute Process Task instead and see what happens. I don't see the need for any VBScripting here.--Lumbago"Real programmers don't document, if it was hard to write it should be hard to understand" |
 |
|
|
lawash44
Starting Member
5 Posts |
Posted - 2006-10-04 : 09:45:29
|
| ThanksI'm sure that the user running this script has operating system permissionsThere is no problem if I use Execute Process Task. I joust see Excel a few seconds(In my excel application i begin with Application.Visible = False) I need to hide the Excel execution. Do you know how can I hide it totally with Execute Process Task ? |
 |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2006-10-04 : 09:55:32
|
| I don't think this is possible but I don't know for sure...it happens for all other applications aswell. I have a few automated ftp scripts that do the same thing...but they usually run on a server so noone sees them pop up.--Lumbago"Real programmers don't document, if it was hard to write it should be hard to understand" |
 |
|
|
lawash44
Starting Member
5 Posts |
Posted - 2006-10-05 : 03:55:03
|
| Thank you for your response. But I need to hide execution.Somebody else has an idea ? |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-10-05 : 04:21:14
|
There is one simple thing you can do:Instead of giving long names in the path, try short names, like this:objShell.Run("c:\progra~1\micros~2\office11\Excel.exe", 1, TRUE)This may solve your problem. To find short names of directory, type this command at command prompt:Dir /x Harsh AthalyeIndia."Nothing is Impossible" |
 |
|
|
lawash44
Starting Member
5 Posts |
Posted - 2006-10-05 : 04:59:05
|
| Thank you very much HarshYou solve my problem !FabriceFrance |
 |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2006-10-05 : 06:46:23
|
| Wow not bad! And I thought that short file/foldernames were a thing of the past...I will definetly put "dir /x" in my bag of tricks!--Lumbago"Real programmers don't document, if it was hard to write it should be hard to understand" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-10-05 : 07:08:54
|
| Or just put double quotes around the program path, in case program files is not progra~1.Peter LarssonHelsingborg, Sweden |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-10-05 : 07:31:27
|
quote: Originally posted by Peso Or just put double quotes around the program path, in case program files is not progra~1.Peter LarssonHelsingborg, Sweden
Peter, How could you possibly put double quotes around path in DTS task?Harsh AthalyeIndia."Nothing is Impossible" |
 |
|
|
|