I have a python script that is taking several CSV files and merging them into one workbook (in different worksheets).
I want to apply on one of the sheets a VBA Macro (.bas code that I wrote, the code supposes to create a button on the work sheet and to execute so style formatting on the data that is on the work sheet.
This is the VBA code that I want to execute (for start as a test).
Attribute VB_Name = "Module1"
Sub Macro1()
'
' Macro1 Macro
'
'
ActiveSheet.Buttons.Add(572.25, 54.75, 43.5, 36).Select
Selection.OnAction = "macro"
End Sub
Sub macro()
Attribute macro.VB_ProcData.VB_Invoke_Func = " \n14"
'
' macro Macro
'
Range("E:E").Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="=1"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
End Sub
In my python script, i'm using openpyxl to create the workbook
I am using python 3.6