Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
pzwonford
New Contributor II

Header align

Hi guys,

I'm exporting to excel using this code

set XLApp = CreateObject("Excel.Application")

XLApp.DisplayAlerts = False

XLApp.Visible = true

set XLDOC = XLApp.Workbooks.Open ("C:\Blank template.xlsx")

ActiveDocument.GetSheetObject("CH01").CopyTableToClipboard true

XLDOC.Sheets(1).Range("a8").Select

XLDoc.Sheets(1).Paste()

Despite what i put in the chart or in the template the header center aligns and i want it to left align. I've tried all sorts of things but i'm stuck - can anyone suggest anything?

1 Solution

Accepted Solutions
Not applicable

Re: Header align

Hi Paul,

Try like that:

sub test

set XLApp = CreateObject("Excel.Application")

XLApp.DisplayAlerts = False

XLApp.Visible = true

set XLDOC = XLApp.Workbooks.Open ("C:\Blank template.xlsx")

ActiveDocument.GetSheetObject("CH01").CopyTableToClipboard true

XLDOC.Sheets(1).Range("a8").Select

XLDoc.Sheets(1).Paste()

'you can change range here

XLDOC.Sheets(1).Range("A8:C8").HorizontalAlignment = -4131

end sub

BR,

Kuba

View solution in original post

2 Replies
Not applicable

Re: Header align

Hi Paul,

Try like that:

sub test

set XLApp = CreateObject("Excel.Application")

XLApp.DisplayAlerts = False

XLApp.Visible = true

set XLDOC = XLApp.Workbooks.Open ("C:\Blank template.xlsx")

ActiveDocument.GetSheetObject("CH01").CopyTableToClipboard true

XLDOC.Sheets(1).Range("a8").Select

XLDoc.Sheets(1).Paste()

'you can change range here

XLDOC.Sheets(1).Range("A8:C8").HorizontalAlignment = -4131

end sub

BR,

Kuba

View solution in original post

pzwonford
New Contributor II

Re: Header align

Thats great thank you