![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | how from VBA to VB Script Hi, I have VBA macro looking: Workbooks.Open("C:\Excel1.xls") Windows("Excel1.xls").Activate() Range("A1").Select() ActiveCell.FormulaR1C1 = "=LEFT('[Excel0.xls]dla HD'!C4,20)" Range("A1").Select() Selection.AutoFill(Destination:=Range("A1:A300"), Type:=xlFillDefault) Range("A1:A300").Select() Windows("Excel1.xls").Activate() ActiveWorkbook.Save() Windows("Excel1.xls").Activate() ActiveWindow.Close() When in SSIS packages i put object Script task and put that code between "Public Sub Main()" and "Dts.TaskResult..." and tried run macro i got few errors. Error 1 Name 'Workbooks' is not declared. dts://Scripts/ScriptTask_6b69bf779c194352a1046a4bfb7ebefa/ScriptMain 29 9 ScriptTask_6b69bf779c194352a1046a4bfb7ebefa Error 2 'System.Windows' is a namespace and cannot be used as an expression. dts://Scripts/ScriptTask_6b69bf779c194352a1046a4bfb7ebefa/ScriptMain 31 9 ScriptTask_6b69bf779c194352a1046a4bfb7ebefa Error 2 'System.Windows' is a namespace and cannot be used as an expression. dts://Scripts/ScriptTask_6b69bf779c194352a1046a4bfb7ebefa/ScriptMain 31 9 ScriptTask_6b69bf779c194352a1046a4bfb7ebefa ... How to do that VBA macro in this script editor? AJA |
My System Specs![]() |
| | #2 (permalink) |
| | Re: how from VBA to VB Script Basically your problems are not initialising some of the objects and using named arguments, these aren't supported in VBScript. I suggest you look at some of these examples on how to fix these issues: http://www.activexperts.com/activmon...soffice/excel/ -- Joe Fawcett (MVP - XML) http://joe.fawcett.name "aja74" <ajanospam74@xxxxxx> wrote in message news:gv5g7u$13e$1@xxxxxx Quote: > Hi, > I have VBA macro looking: > Workbooks.Open("C:\Excel1.xls") > Windows("Excel1.xls").Activate() > Range("A1").Select() > ActiveCell.FormulaR1C1 = "=LEFT('[Excel0.xls]dla HD'!C4,20)" > Range("A1").Select() > Selection.AutoFill(Destination:=Range("A1:A300"), > Type:=xlFillDefault) > Range("A1:A300").Select() > Windows("Excel1.xls").Activate() > ActiveWorkbook.Save() > Windows("Excel1.xls").Activate() > ActiveWindow.Close() > > When in SSIS packages i put object Script task and put that code > between > "Public Sub Main()" and "Dts.TaskResult..." and tried run macro i got > few > errors. > > > Error 1 Name 'Workbooks' is not declared. > dts://Scripts/ScriptTask_6b69bf779c194352a1046a4bfb7ebefa/ScriptMain 29 9 > ScriptTask_6b69bf779c194352a1046a4bfb7ebefa > > Error 2 'System.Windows' is a namespace and cannot be used as an > expression. > dts://Scripts/ScriptTask_6b69bf779c194352a1046a4bfb7ebefa/ScriptMain 31 9 > ScriptTask_6b69bf779c194352a1046a4bfb7ebefa > > Error 2 'System.Windows' is a namespace and cannot be used as an > expression. > dts://Scripts/ScriptTask_6b69bf779c194352a1046a4bfb7ebefa/ScriptMain 31 9 > ScriptTask_6b69bf779c194352a1046a4bfb7ebefa > ... > > How to do that VBA macro in this script editor? > > AJA > > > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: how from VBA to VB Script > Basically your problems are not initialising some of the objects and using Quote: > named arguments, these aren't supported in VBScript. > I suggest you look at some of these examples on how to fix these issues: > http://www.activexperts.com/activmon...soffice/excel/ Another question, when i have opened 2 excels, how to copy columns from one to secound excel but from some columns make substring(column,1,10) AJA |
My System Specs![]() |
| | #4 (permalink) |
| | Re: how from VBA to VB Script In the scripting help file, script56.chm which is probably on your system and downloadable through msdn.microsoft.com, through the contents tab, into the VBScript Users Guide section, there are sections on VBScript features not in VBA and VBA features not in VBScript. These should help your understanding of the problem. -Paul Randall "aja74" <ajanospam74@xxxxxx> wrote in message news:gv5g7u$13e$1@xxxxxx Quote: > Hi, > I have VBA macro looking: > Workbooks.Open("C:\Excel1.xls") > Windows("Excel1.xls").Activate() > Range("A1").Select() > ActiveCell.FormulaR1C1 = "=LEFT('[Excel0.xls]dla HD'!C4,20)" > Range("A1").Select() > Selection.AutoFill(Destination:=Range("A1:A300"), > Type:=xlFillDefault) > Range("A1:A300").Select() > Windows("Excel1.xls").Activate() > ActiveWorkbook.Save() > Windows("Excel1.xls").Activate() > ActiveWindow.Close() > > When in SSIS packages i put object Script task and put that code > between > "Public Sub Main()" and "Dts.TaskResult..." and tried run macro i got > few > errors. > > > Error 1 Name 'Workbooks' is not declared. > dts://Scripts/ScriptTask_6b69bf779c194352a1046a4bfb7ebefa/ScriptMain 29 9 > ScriptTask_6b69bf779c194352a1046a4bfb7ebefa > > Error 2 'System.Windows' is a namespace and cannot be used as an > expression. > dts://Scripts/ScriptTask_6b69bf779c194352a1046a4bfb7ebefa/ScriptMain 31 9 > ScriptTask_6b69bf779c194352a1046a4bfb7ebefa > > Error 2 'System.Windows' is a namespace and cannot be used as an > expression. > dts://Scripts/ScriptTask_6b69bf779c194352a1046a4bfb7ebefa/ScriptMain 31 9 > ScriptTask_6b69bf779c194352a1046a4bfb7ebefa > ... > > How to do that VBA macro in this script editor? > > AJA > > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Logon Script Causing Laptops To Hang - Problems in script? | VB Script | |||
| problem passing args to script 'There is no script engine for file extenstion' | VB Script | |||
| Include another script, keep variables in included script? | PowerShell | |||
| Script file has 'OS Handle' error when run from script | PowerShell | |||
| Can you drag-n-drop a file on top of a PS script to run the script? | PowerShell | |||