Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
gf
Creator III
Creator III

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 Solution

Accepted Solutions
Brett_Bleess
Former Employee
Former Employee

If this is working in Desktop and not from QlikView Server, the issue is going to be the Export function/API, you need to use the Server-side API in that case:

ServerSideExportEx

You will find further information in the API Guide QVW file, which I have attached a version for you in case you do not have it.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.

View solution in original post

2 Replies
gf
Creator III
Creator III
Author

The terminal server where qlikview is provided uses Excel 2010.
Brett_Bleess
Former Employee
Former Employee

If this is working in Desktop and not from QlikView Server, the issue is going to be the Export function/API, you need to use the Server-side API in that case:

ServerSideExportEx

You will find further information in the API Guide QVW file, which I have attached a version for you in case you do not have it.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.