Excel cell format.(Power Automate Desktop)

Japanese version.

Here is a flow for formatting Excel cells.

Steps

Currently, there is no action for formatting, so VBScript is used to set it.

To do so, put "Run VBScript" in place.

Specify the following code for "VBScript to execute.

Lines beginning with ' are commented out (disabled).

If necessary, remove the ' to enable it.

On Error Resume Next

Dim xls, book
Set xls = CreateObject("Excel.Application")

' Specify the file.
Set book = xls.Workbooks.Open("C:\Test\Test.xlsx") 

' Specify sheet/cell.
Set cell = book.Sheets("Sheet1").Range("B2")     ' Specify by cell address
' Set cell = book.Sheets("Sheet1").Cells(1,1)      ' Specify by number of rows and columns

' Font
' cell.Font.Name = "Calibri"

' Font Color
' cell.Font.Color = RGB(0, 255, 0)

' Font Size
' cell.Font.Size = 16

' Itaric
' cell.Font.Italic = True  ' ON
' cell.Font.Italic = False ' OFF

' Bold
' cell.Font.Bold = True ' ON
' cell.Font.Bold = False ' OFF

' Text Alignment Horizonal
' cell.HorizontalAlignment = 1     ' General
' cell.HorizontalAlignment = -4131 ' Left (Indent)
' cell.HorizontalAlignment = -4108 ' Center
' cell.HorizontalAlignment = -4152 ' Right (Indent)

' Text Alignment Vertical
' cell.VerticalAlignment  = -4160 ' Top
' cell.VerticalAlignment  = -4108 ' Center
' cell.VerticalAlignment  = -4107 ' Bottom

' Underline
' cell.Font.Underline = -4142 ' None
' cell.Font.Underline = 2     ' Single
' cell.Font.Underline = 4     ' Double
' cell.Font.Underline = 5     ' SingleAccounting
' cell.Font.Underline = -4119 ' DoubleAccounting

' Strikethrough
' cell.Font.Strikethrough = True  ' ON
' cell.Font.Strikethrough = False ' OFF

' cell.Interior.Color = RGB(100, 100, 100) 'Background color

' Borders
' N in Borders(N) is the position of the ruled line. If (N) is deleted and only Borders is used, it is up, down, left, and right.
' 7...left, 8...top, 9...bottom, 10...right, 5...top left to bottom right, 6...top right to bottom left

' Border Line Style
' cell.Borders(9).LineStyle = 1     ' Continuous
' cell.Borders(9).LineStyle = -4115 ' Dash
' cell.Borders(9).LineStyle = 4     ' DashDot
' cell.Borders(9).LineStyle = 5     ' DashDotDot
' cell.Borders(9).LineStyle = -4118 ' Dot
' cell.Borders(9).LineStyle = -4119 ' Double
' cell.Borders(9).LineStyle = 13    ' SlantDashDot
' cell.Borders(9).LineStyle = -4142 ' None

' Border Weight
' cell.Borders(9).Weight = 1        ' Hairline
' cell.Borders(9).Weight = 2        ' Thin
' cell.Borders(9).Weight = -4138    ' Medium
' cell.Borders(9).Weight = 4        ' Thick

' cell.Borders(9).Color = RGB(0, 255, 255)  ' Border Color
 
 
book.Save
book.Close
xls.Quit


Set book = Nothing
Set xls = Nothing

For those who want to learn Power Automate Desktop effectively


The information on this site is now available in an easy-to-read e-book format.

Or Kindle Unlimited (unlimited reading).

You willl discover how to about basic operations.

By the end of this book, you will be equipped with the knowledge you need to use Power Automate Desktop to streamline your workflow.

Table of Contents.

Update History.

Links

Tips(Power Automate Desktop)