Read Posted October 8, 2010 Share Posted October 8, 2010 Sheet: January 2011 and A1 February. How can it: February ??? Code: _ExcelWriteCell($oExcel, "January", "A1") February 2011 is empty - That's bad. I want: January 2011 and A1 January. February 2011 and A1 February How to use Bold/color? <B>January</B> #include <Excel.au3> Local $January = "January 2011" $oExcel = _ExcelBookNew() With $oExcel .ActiveWorkbook.Sheets(1).Name = $January EndWith $oExcel.Range("A1").Select _ExcelWriteCell($oExcel, "January", "A1") Local $February = "February 2011" With $oExcel .ActiveWorkbook.Sheets(2).Name = $February EndWith $oExcel.Range("A1").Select _ExcelWriteCell($oExcel, "February", "A1") Thanks Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 8, 2010 Share Posted October 8, 2010 You didn't change the active sheet to Sheets(2) just by renaming it, did you? So _ExcelWriteCell() is going to Sheets(1) both times. Try _ExcelSheetActivate(). 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...
TwistedGA Posted October 8, 2010 Share Posted October 8, 2010 I'm bored. Less mess. #include <Excel.au3> $mJan = 'January 2011' $mFeb = 'February 2011' $oExcel = _ExcelBookNew() _ExcelSheetNameSet($oExcel, $mJan) _ExcelWriteCell($oExcel, StringTrimRight($mJan, 5), 1, 1) _ExcelSheetActivate($oExcel, 2) _ExcelSheetNameSet($oExcel, $mFeb) _ExcelWriteCell($oExcel, StringTrimRight($mFeb, 5), 1, 1) Link to comment Share on other sites More sharing options...
Read Posted October 8, 2010 Author Share Posted October 8, 2010 Hmm, I assume that i am doing something wrong. Error (Line9): Incorrect number of parameters in function call I searching forum "_ExcelSheetActivate()" only 2 post #include <Excel.au3> Local $January = "January 2011" $oExcel = _ExcelBookNew() With $oExcel .ActiveWorkbook.Sheets(1).Name = $January EndWith $oExcel.Range("A1").Select _ExcelSheetActivate($oExcel, "January", "A1") Local $February = "February 2011" With $oExcel .ActiveWorkbook.Sheets(2).Name = $February EndWith $oExcel.Range("A1").Select _ExcelWriteCell($oExcel, "February", "A1") You didn't change the active sheet to Sheets(2) just by renaming it, did you? So _ExcelWriteCell() is going to Sheets(1) both times. Try _ExcelSheetActivate(). Link to comment Share on other sites More sharing options...
Read Posted October 8, 2010 Author Share Posted October 8, 2010 (edited) Work but more easily. Im noob, sorry. Where you take January and February? If I want write A1 "Welcome" how them? I'm bored. Less mess. #include <Excel.au3> $mJan = 'January 2011' $mFeb = 'February 2011' $oExcel = _ExcelBookNew() _ExcelSheetNameSet($oExcel, $mJan) _ExcelWriteCell($oExcel, StringTrimRight($mJan, 5), 1, 1) _ExcelSheetActivate($oExcel, 2) _ExcelSheetNameSet($oExcel, $mFeb) _ExcelWriteCell($oExcel, StringTrimRight($mFeb, 5), 1, 1) Edited October 9, 2010 by Read Link to comment Share on other sites More sharing options...
Read Posted October 8, 2010 Author Share Posted October 8, 2010 Someone? wakillon? Link to comment Share on other sites More sharing options...
MrMitchell Posted October 8, 2010 Share Posted October 8, 2010 The script as-is, as written by TwistedGA, will open Excel and make the first sheet's name "January 2011", then cell A1 says "January". Sheet 2's name becomes "February 2011" and A1 on that sheet says "February". So what else did you need to do? Link to comment Share on other sites More sharing options...
TwistedGA Posted October 9, 2010 Share Posted October 9, 2010 Work but more easily. Im noob, sorry. Where I use A1 "text" B6 "text" Where you take January and February? If I want write A1 "Welcome" how them? You can write to a cell two basic ways using _ExcelWriteCell, they are: _ExcelWriteCell($oExcel, 'Some Text', 1, 1);1, 1 = row1, col1 $var = 'Some Text' _ExcelWriteCell($oExcel, $var, 1, 1);1, 1 = row1, col1 To make A2 read 'Welcome', I would add this line to my previous posts script. I chose A2 to keep February in Cell A1. _ExcelWriteCell($oExcel, 'Welcome', 2, 1) Link to comment Share on other sites More sharing options...
Read Posted October 11, 2010 Author Share Posted October 11, 2010 B4 "Text" > Right (xlRight) How make it? $oExcel.Cells(4, 2).Value = "Text" ;B4 $oExcel.Range("B4").Select $oExcel.Selection.Font.Bold = True With $oExcel.Selection.Font .Name = "Arial" .Size = 10 I tried to change it $oExcel.Activesheet.Columns("B:B").HorizontalAlignment = 4; vs $oExcel.Activesheet.Columns("B4").HorizontalAlignment = 4; Yes, it's not work Link to comment Share on other sites More sharing options...
GMK Posted October 11, 2010 Share Posted October 11, 2010 Try: $oExcel.Range("B4").Select $oExcel.Selection.HorizontalAlignment = -4152 Link to comment Share on other sites More sharing options...
Read Posted October 11, 2010 Author Share Posted October 11, 2010 Too easy Work. Thanks Try: $oExcel.Range("B4").Select $oExcel.Selection.HorizontalAlignment = -4152 Link to comment Share on other sites More sharing options...
GMK Posted October 11, 2010 Share Posted October 11, 2010 You're welcome. If you prefer, you can use the constant from the Excel.au3 UDF: $oExcel.Selection.HorizontalAlignment = $xlRight Too easy Work. Thanks Link to comment Share on other sites More sharing options...
Read Posted October 14, 2010 Author Share Posted October 14, 2010 What Borders is it or where i can see list?$oExcel.Selection.Borders.LineStyle = number Link to comment Share on other sites More sharing options...
MrMitchell Posted October 14, 2010 Share Posted October 14, 2010 (edited) Open up Visual Basic Editor (from Excel press ALT+F11) then press F2 when you get into Visual Basic to get you into Object Browser. From there do a search for "xlLineStyle". Edited October 14, 2010 by MrMitchell Link to comment Share on other sites More sharing options...
Read Posted October 14, 2010 Author Share Posted October 14, 2010 I did code but number is wrong / -4115 And this site not help me or help: http://msdn.microsoft.com/en-us/library/aa221100%28v=office.11%29.aspx $oExcel.Range("B7:F31").Select $oExcel.Selection.Borders.LineStyle = -4115 Open up Visual Basic Editor (from Excel press ALT+F11) then press F2 when you get into Visual Basic to get you into Object Browser. From there do a search for "xlLineStyle". Link to comment Share on other sites More sharing options...
JoHanatCent Posted October 15, 2010 Share Posted October 15, 2010 (edited) I did code but number is wrong / -4115 And this site not help me or help: http://msdn.microsoft.com/en-us/library/aa221100%28v=office.11%29.aspx $oExcel.Range("B7:F31").Select $oExcel.Selection.Borders.LineStyle = -4115 xlContinuous = 1 Edit: Like so: $oExcel.Selection.Borders.LineStyle = 1 $oExcel.Selection.Borders.Weight = 1 Edited October 15, 2010 by JoHanatCent Link to comment Share on other sites More sharing options...
Read Posted October 16, 2010 Author Share Posted October 16, 2010 How to add a comment?Here is the error I think: .Comment.Text text="123:"$oExcel.Range("E7").AddComment $oExcel.Range("E7").Comment.Visible = False $oExcel.Range("E7").Comment.Text text="123:" & Chr(10) & "1234" Link to comment Share on other sites More sharing options...
Read Posted October 17, 2010 Author Share Posted October 17, 2010 Nobody knows, how to add a comment in Excel? Link to comment Share on other sites More sharing options...
JoHanatCent Posted October 17, 2010 Share Posted October 17, 2010 Nobody knows, how to add a comment in Excel?$oExcel.Range("E7").Comment.Text("Comment:" & Chr(10) & "1234") 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