Jump to content

Recommended Posts

Posted

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:

Posted Image

There are some things I do not know:

1) What combine calls

2) how to write in the center

3) How to set background color

4) 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.

Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted (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 by Guest
Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted (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 by Guest
Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

I will test and post the results as soon as I'm in my office again tomorrow.

Thank you :)

Posted

BTW: Which version of Excel do you run?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

BTW: Which version of Excel do you run?

Excel 2010

But it would be better if it also will work for Excel 2013

Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...