Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
roee1983
Contributor III
Contributor III

Add a Command in Macro

Hi all,

I would appreciate your help with adding a Command to a Macro I found in the Community.

I need to get the chart caption in Bold  with Columns AutoFit .

Thanks from advance

Roee

sub test



'Set the path where the excel will be saved

filePath = "..Test.xlsx"



'Create the Excel spreadsheet

Set excelFile = CreateObject("Excel.Application")

excelFile.Visible = true

'Create the WorkBook

Set curWorkBook = excelFile.WorkBooks.Add

'Create the Sheet



'first chart object

Set curSheet = curWorkBook.WorkSheets(1)
curSheet.visible=True





'loop

chartArray = Array("1","2")

usedRows=0

For Each chart In chartArray

Set i = ActiveDocument.GetSheetObject(chart)

chartCaption = i.GetCaption.Name.v




curSheet.Cells(usedRows+1, 1)=chartCaption

i.CopyTableToClipboard true

curSheet.Cells(usedRows+3, 1).Select
'Selection.Font.Bold = True = chartCaption

curSheet.Paste

usedRows=curSheet.UsedRange.Rows.Count+3 '--->function to get the first unused row

Next

'loop end



excelFile.Visible = true

'Save the file and quit excel

curWorkBook.SaveAs filePath

curWorkBook.Close

excelFile.Quit



'Cleanup

Set curWorkBook = nothing

Set excelFile = nothing

end sub

0 Replies