Guest Posted December 17, 2012 Share Posted December 17, 2012 Hello,I'm trying to do something complicated compared to what I've done so far with the function Excel.au3.Until now I did not need much help to do what I wanted because all the examples in UDF ..But now there are things I do not have examples in UDF and I need examples ..That's what I want to do:There are some things I do not know:1) What combine calls2) how to write in the center3) How to set background color4) How to increase the size of the letters.5) how to define the The black lines..Hope not missed anything ..it looks scary .. It's much more serious than what I did so far ..Hope you understand and help me ..Thank you. Link to comment Share on other sites More sharing options...
water Posted December 17, 2012 Share Posted December 17, 2012 Some examples: 1) $oExcel.ActiveSheet.Range("A1:A3").Merge() 2) $oExcel.ActiveSheet.Range("A1:A3").HorizontalAlignment($xlCenter) 3) $oExcel.ActiveSheet.Range("A1:A3").Interior.ColorIndex = 8 ; Cyan 4) $oExcel.ActiveSheet.Range("A1:A3").Font.Size = 10 5) With $oExcel.ActiveSheet.Range("A1:A3").Borders($xlEdgeBottom) .LineStyle = $xlContinuous .Weight = $xlThin .ColorIndex = 3 EndWith My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Guest Posted December 17, 2012 Share Posted December 17, 2012 (edited) Some examples: 1) $oExcel.ActiveSheet.Range("A1:A3").Merge() 2) $oExcel.ActiveSheet.Range("A1:A3").HorizontalAlignment($xlCenter) 3) $oExcel.ActiveSheet.Range("A1:A3").Interior.ColorIndex = 8 ; Cyan 4) $oExcel.ActiveSheet.Range("A1:A3").Font.Size = 10 5) With $oExcel.ActiveSheet.Range("A1:A3").Borders($xlEdgeBottom) .LineStyle = $xlContinuous .Weight = $xlThin .ColorIndex = 3 EndWith Thanks but nothing works except $oExcel.ActiveSheet.Range("A1:A3").Merge() .. I examine these lines of code through this Test: #include <Excel.au3> $oExcel = _ExcelBookOpen(@ScriptDir & "" & "test.xls") $oExcel.ActiveSheet.Range("A1:A3").Merge() ; <---------------------------- Here I put the line of code. ;_ExcelBookSaveAs($oExcel, @ScriptDir & "" & "test.xls", "xls") $file = "test.xls" ;ExelClose() Func ExelClose() Sleep(500) If $oExcel.Application.Workbooks.Count > 1 Then $oExcel.Close $oExcel = '' $oExcel = ObjGet("", "Excel.Application") ; Restore the users specified settings $oExcel.Application.DisplayAlerts = $fDisplayAlerts $oExcel.Application.ScreenUpdating = $fScreenUpdating $oExcel = '' Else $oExcel.Application.Quit EndIf EndFunc Edited December 17, 2012 by Guest Link to comment Share on other sites More sharing options...
water Posted December 17, 2012 Share Posted December 17, 2012 How do you set the variables used in my last post?Example:2) You have to use the following enumeration for alignment. Center = -4108 My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Guest Posted December 17, 2012 Share Posted December 17, 2012 (edited) I changed the line: $oExcel.ActiveSheet.Range("A1:A3").HorizontalAlignment($xlCenter) to $oExcel.ActiveSheet.Range("A1:A3").HorizontalAlignment(-4108) but still not works.. Edited December 17, 2012 by Guest Link to comment Share on other sites More sharing options...
water Posted December 17, 2012 Share Posted December 17, 2012 I will test and post the results as soon as I'm in my office again tomorrow. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Guest Posted December 17, 2012 Share Posted December 17, 2012 I will test and post the results as soon as I'm in my office again tomorrow.Thank you Link to comment Share on other sites More sharing options...
water Posted December 17, 2012 Share Posted December 17, 2012 BTW: Which version of Excel do you run? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Guest Posted December 17, 2012 Share Posted December 17, 2012 BTW: Which version of Excel do you run?Excel 2010But it would be better if it also will work for Excel 2013 Link to comment Share on other sites More sharing options...
water Posted December 18, 2012 Share Posted December 18, 2012 This works fine for me running Excel 2010: #include $oExcel = _ExcelBookOpen(@ScriptDir & "" & "test.xls") $oRange = $oExcel.ActiveSheet.Range("A1:C1") $oRange.Merge() MsgBox(0, "Excel", "Cells A1:C1 have been merged") $oRange = $oExcel.ActiveSheet.Range("A2:C2") $oRange.Value = "*****" $oRange.HorizontalAlignment = $xlCenter MsgBox(0, "Excel", "Horizontal formatting for cells A2:C2 set to centered") $oRange.Interior.ColorIndex = 8 ; Cyan MsgBox(0, "Excel", "Color for cells A2:C2 set to Cyan") $oRange.Font.Size = 14 MsgBox(0, "Excel", "Font size for cells A2:C2 set to 14") With $oRange.Borders($xlEdgeBottom) .LineStyle = $xlContinuous .Weight = $xlThin .ColorIndex = 3 EndWith MsgBox(0, "Excel", "Bottom borders (line style, weight, color) for cells A2:C2 set") My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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