Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Can not get VerticalAllignmetnt in macro

Hi,

I am trying to get a format in my export to Excel. When i run this Macro:

Sub Export

DIM ExcelApplication, ExcelWorkbook

SET ExcelApplication = CREATEOBJECT("Excel.Application")

SET ExcelWorkbook = ExcelApplication.Workbooks.Add

ActiveDocument.GetSheetObject("CH14").CopyTableToClipBoard TRUE

ExcelWorkbook.Worksheets(1).Paste

ExcelWorkbook.Worksheets(1).Cells.EntireRow.RowHeight = 12.75

ExcelWorkbook.Worksheets(1).Cells.VerticalAlignment = xlTop

ExcelApplication.DisplayAlerts = FALSE

ExcelWorkbook.SaveAs "C:\QlikView\Export\Assortiment\Geactiveerd assortiment\WeerActiefAssortiment.xls", 56

ExcelApplication.Quit

'MsgBox "Export Complete Sort"

End Sub

I am getting the error "Unable to set the VerticalAlignment property of the Range class" on the line ExcelWorkbook.Worksheets(1).Cells.VerticalAlignment = xlTop.

Anyone any idea what i am doing wrong?

Regards,

Carel

1 Solution

Accepted Solutions
marcus_sommer

Try it with replacing of xlTop with -4160. See for it: Constants-Enumeration (Microsoft.Office.Interop.Excel)

- Marcus

View solution in original post

2 Replies
marcus_sommer

Try it with replacing of xlTop with -4160. See for it: Constants-Enumeration (Microsoft.Office.Interop.Excel)

- Marcus

Anonymous
Not applicable
Author

Hi Marcus,

Thanks, that was the solution!

Carel