Hardnik Posted December 4, 2007 Share Posted December 4, 2007 hello please help to translate this vbs script in the format of autoit Dim objXL Set objXL = WScript.CreateObject("Excel.Application") objXL.Visible = false objXL.Workbooks.Open ("\\file\bin$\dev\forum.xls") Set modAdd = objXL.Workbooks.Open("\\file\bin$\PRICE.xla") objXL.Run modAdd.Name & "!price.price" objXL.Run modAdd.Name & "!Price.hide" objXL.DisplayAlerts = False objXL.ActiveWorkbook.SaveAs "\\file\bin$\dev\price.xls" objXL.Workbooks.Close objXL.DisplayAlerts = True objXL.Quit beforehand thank you Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 4, 2007 Share Posted December 4, 2007 hello please help to translate this vbs script in the format of autoit Dim objXL Set objXL = WScript.CreateObject("Excel.Application") objXL.Visible = false objXL.Workbooks.Open ("\\file\bin$\dev\forum.xls") Set modAdd = objXL.Workbooks.Open("\\file\bin$\PRICE.xla") objXL.Run modAdd.Name & "!price.price" objXL.Run modAdd.Name & "!Price.hide" objXL.DisplayAlerts = False objXL.ActiveWorkbook.SaveAs "\\file\bin$\dev\price.xls" objXL.Workbooks.Close objXL.DisplayAlerts = True objXL.Quit beforehand thank you 1. Take all the "Set" commands out, AutoIt doesn't need "Set" to do assignment. 2. Put a dollar sign "$" in front of every instance of the objXL and $modAdd variables. 3. Put parameters inside parens, i.e. objXL.Run(modAdd.Name & "!price.price") Like the Water Boy, "You can do it!" Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Hardnik Posted December 5, 2007 Author Share Posted December 5, 2007 (edited) at the use of code there is an error in ecxel with an original vbs script all is normal error: in scite: \\file\bin$\price.au3 (62) : ==> The requested action with this object has failed.: $objXL.Run($modAdd.Name & "!price.price") $objXL.Run($modAdd.Name & "!price.price")^ ERROR in excel: Run-time error '1004': it is impossible to set property of NumberFormat of class of Range Dim $objXL Dim $modAdd $objXL = ObjCreate("Excel.Application") $objXL.Visible = false $objXL.Workbooks.Open ("\\file\bin$\dev\forum.xls") $modAdd = $objXL.Workbooks.Open("\\file\bin$\PRICE.xla") $objXL.Run($modAdd.Name & "!price.price");error in this place $objXL.Run($modAdd.Name & "!Price.hide") $objXL.DisplayAlerts = False $objXL.ActiveWorkbook.SaveAs("\\file\bin$\dev\price.xls") $objXL.Workbooks.Close $objXL.DisplayAlerts = True $objXL.Quit p.s. please will excuse if talk wrong utillize translator Edited December 5, 2007 by Hardnik Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 5, 2007 Share Posted December 5, 2007 (edited) at the use of code there is an error in ecxel with an original vbs script all is normal error: in scite: \\file\bin$\price.au3 (62) : ==> The requested action with this object has failed.: $objXL.Run($modAdd.Name & "!price.price") $objXL.Run($modAdd.Name & "!price.price")^ ERROR in excel: Run-time error '1004': it is impossible to set property of NumberFormat of class of Range p.s. please will excuse if talk wrong utillize translator You translated the VBScript to AutoIt exactly as I would have. The strange thing is that error seems to come from an error inside the macro, not in the script code. Unfortunately, without the .xls and .xla files including the macros, I don't see how to debug further. P.S. Are those paths correct at "\\file\bin$\dev\forum.xls" and "\\file\bin$\PRICE.xla"? There is a UNC path to a file server called "file" with a share called "bin$", etc.? I am asking because I wonder if they are interpreted differently in VBScript. Doesn't seem likely, but can be tested by adding this where you are opening the files: Dim $sXLS = "\\file\bin$\dev\forum.xls" Dim $sXLA = "\\file\bin$\PRICE.xla" If FileExists($sXLS) And FileExists($sXLA) Then $objXL.Workbooks.Open ($sXLS) $modAdd = $objXL.Workbooks.Open($sXLA) Else MsgBox(16, "Error", "At least one file not found!") Exit EndIf Edited December 5, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now