Ciao a tutti...
devo generare un vbscript da una macro excel, questa:

sub mia()

Const MAX_COL = 5
Const MAX_ROW = 6
Dim in_Col As Integer, in_Row As Integer
Const FileName1 As String = "c:\file1.xls"
Const FileName2 As String = "c:\file22.xls"
Const FileNameFinale As String = "c:\filefinale12.xls"

Dim obEx1 As Excel.Application
Dim obEx2 As Excel.Application
Dim obExFinale As Excel.Application
Dim wbEx1 As Excel.Workbook
Dim wbEx2 As Excel.Workbook
Dim wbExFinale As Excel.Workbook

Set obEx1 = New Excel.Application
Set obEx2 = New Excel.Application
Set obExFinale = New Excel.Application
Set wbEx1 = obEx1.Workbooks.Open(FileName1)
Set wbEx2 = obEx2.Workbooks.Open(FileName2)
Set wbExFinale = obExFinale.Workbooks.Open(FileNameFinale)



Dim i As Integer
For i = 1 To wbEx1.Worksheets.Count

Dim newWs As Excel.Worksheet

Set newWs = wbExFinale.Worksheets.Add

With wbEx1.Worksheets.Item(i)

newWs.Name = "A" & " " & i 'wbEx1.Worksheets.Item(i).Name & " " & i

For in_Col = 1 To MAX_COL
For in_Row = 1 To MAX_ROW

newWs.Cells(in_Row, in_Col) = .Cells(in_Row, in_Col)

Next in_Row
Next in_Col


End With
Next i


Dim j As Integer
For j = 1 To wbEx2.Worksheets.Count

Dim newWs1 As Excel.Worksheet

Set newWs1 = wbExFinale.Worksheets.Add

With wbEx2.Worksheets.Item(j)

newWs1.Name = "B" & " " & j 'wbEx2.Worksheets.Item(j).Name & " " & j

For in_Col = 1 To MAX_COL
For in_Row = 1 To MAX_ROW

newWs1.Cells(in_Row, in_Col) = .Cells(in_Row, in_Col)

Next in_Row
Next in_Col


End With
Next j

obExFinale.Visible = True


End Sub
Ho iniziato a fare una cosa del genere ,non so come fare e vado a tentativi, ma mi da errore perchè non trova la classe excel:

Const MAX_COL = 5
Const MAX_ROW = 6
Dim in_Col , in_Row
Const FileName1 = "c:\file1.xls"
Const FileName2 = "c:\file22.xls"
Const FileNameFinale = "c:\filefinale12.xls"

Dim obEx1
Dim obEx2
Dim obExFinale
Dim wbEx1
Dim wbEx2
Dim wbExFinale

Set obEx1 = New Excel.Application
Set obEx2 = New Excel.Application
Set obExFinale = New Excel.Application
Set wbEx1 = obEx1.Workbooks.Open(FileName1)
Set wbEx2 = obEx2.Workbooks.Open(FileName2)
Set wbExFinale = obExFinale.Workbooks.Open(FileNameFinale)



Dim i
For i = 1 To wbEx1.Worksheets.Count

Dim newWs

Set newWs = wbExFinale.Worksheets.Add

With wbEx1.Worksheets.Item(i)

newWs.Name = "A" & " " & i 'wbEx1.Worksheets.Item(i).Name & " " & i

For in_Col = 1 To MAX_COL
For in_Row = 1 To MAX_ROW

newWs.Cells(in_Row, in_Col) = .Cells(in_Row, in_Col)

Next
Next


End With
Next


Dim j
For j = 1 To wbEx2.Worksheets.Count

Dim newWs1

Set newWs1 = wbExFinale.Worksheets.Add

With wbEx2.Worksheets.Item(j)

newWs1.Name = "B" & " " & j 'wbEx2.Worksheets.Item(j).Name & " " & j

For in_Col = 1 To MAX_COL
For in_Row = 1 To MAX_ROW

newWs1.Cells(in_Row, in_Col) = .Cells(in_Row, in_Col)

Next
Next


End With
Next

obExFinale.Visible = True


come fare?