Jump to content

[SOLVED] Question about word automation


Recommended Posts

Hi all,

I need a little help regarding a Word issue.

I'm automating (whit success) a word document starting from a text file. 

I'm able to create a new document, write text, add tables, using both Word UDF and Word objects.

 

I'm creating a new table

$oTable = $oDoc.Tables.Add($oEndDocRange, 2, 4)
$oTable.Columns(1).Width = 60
$oTable.Columns(2).Width = 420
With $oTable.Borders
    .InsideLineStyle = 1 ;wdLineStyleSingle
    .OutsideLineStyle = 1 ;wdLineStyleDouble
EndWith

$Row = 1
$Col = 2
$oCellRange = $oTable.Cell($Row,$Col).Range
$oCellRange.Text = "Espressione"
$oCellRange.Font.Bold = True
$oCellRange.Shading.BackgroundPatternColor = -603917569

 

Now I want to resize the width of a SINGLE CELL (not the entire column)

I registered a VBA marcro and this is the code

Selection.Tables(1).Columns(1).SetWidth ColumnWidth:=50, RulerStyle:=wdAdjustFirstColumn

Can help me to translate this VBA in AutoIT?

Or, there is more correct way to resize a cell?

Thanks a lot!

   

 

 

 

 

Edited by polps
Link to post
Share on other sites

Cell object.  Google your problem in vbs and it's easy to convert to autoit.

 

https://docs.microsoft.com/en-us/office/vba/api/word.table.cell

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to post
Share on other sites

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