Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
gf
Contributor II

Macro to merge cells doesn't work

Hello all!

I have a problem with my macro.

I'm trying to merge cell A1:J1. The solutions provided in our community didn't help.

May some of you can tell me what is wrong in my macro.

Thanks in advance!

sub ExExport

	Set excelFile = CreateObject("Excel.Application")

     excelFile.Visible = true
     
     Set curWorkBook = excelFile.WorkBooks.Add
     
     Set curSheet = curWorkBook.WorkSheets(1)
     
     Set tableToExport = ActiveDocument.GetSheetObject("CH03")

     Set chartProperties = tableToExport.GetProperties

     tableToExport.CopyTableToClipboard true
     
     chartCaption = tableToExport.GetCaption.Name.v
     
     curSheet.Range("A1") = chartCaption
     
     curSheet.Paste curSheet.Range("A2")
	
     excelFile.Visible = true
     
     curSheet.UsedRange.Columns.AutoFit
		
	 curSheet.UsedRange.Rows.AutoFit
	 
	 excelFile.ActiveSheet.Range("A1:J1").Merge
	 
	 excelFile.ActiveSheet.Range("A1:J1").HorizontalAlignment = xlCenter
	 
	 excelFile.ScreenUpdating = True

end sub
Labels (4)
1 Reply
gf
Contributor II

Re: Macro to merge cells doesn't work

The terminal server where qlikview is provided uses Excel 2010.