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 comment
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
 Share

  • Recently Browsing   0 members

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