Tonych Posted February 14, 2009 Share Posted February 14, 2009 I have a Excel macro: n = 2 if t > 25 Then For i = 1 To Int(t / 25) Sheets(2).Select Sheets(2).Copy After:=Sheets(n) n = n + 1 Sheets(n).Select Sheets(n).Name = "Sheet" & CStr(n) Next i End If There is a form in Sheet2, I need to copy it so that I can put 25 datas in every worksheet. I want to make it in AutoIt, please anyone could give me some advice! Thanks in advance! Link to comment Share on other sites More sharing options...
jasonlg3d Posted February 18, 2009 Share Posted February 18, 2009 I'm not really sure what you're asking. Could you explain in a little more detail and maybe someone can help you. Link to comment Share on other sites More sharing options...
Tonych Posted February 20, 2009 Author Share Posted February 20, 2009 Thanks for you concern! I am sorry I did not tell it clearly. The main problem is that I want to translate the VBA macro: Sheets(2).Copy After:=Sheets(2) into AutoIt. Thanks in advance! Link to comment Share on other sites More sharing options...
Juvigy Posted April 10, 2009 Share Posted April 10, 2009 why not ? 1.Open excel 2.Open the file 3.Import the VBA macro 4.Run it Link to comment Share on other sites More sharing options...
AlexII Posted April 11, 2009 Share Posted April 11, 2009 Thanks for you concern! I am sorry I did not tell it clearly. The main problem is that I want to translate the VBA macro: Sheets(2).Copy After:=Sheets(2) into AutoIt. Thanks in advance!Tonych, try use positional notation of argument list: Worksheet.Copy(Before, After)and «Default» AutoIt-keyword for optional argument. Example code: Local $objExcel Local $objWorkbook Local $objWorksheet $objExcel = ObjCreate("Excel.Application") $objExcel.Visible = True $objWorkbook = $objExcel.Workbooks.Add() $objWorksheet = $objWorkbook.Worksheets(1) ; Mark this worksheet by text $objWorksheet.Cells(1,1).Value = "Example" $objWorksheet.Name = "Example" ; Add some worksheets $objWorkbook.Worksheets.Add $objWorkbook.Worksheets.Add $objWorkbook.Worksheets.Add $objWorkbook.Worksheets.Add $objWorkbook.Worksheets.Add $objWorkbook.Worksheets.Add ; Copy this worksheet $objWorksheet.Copy(Default, $objWorkbook.Worksheets(2)) 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