Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
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
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
Thats great thank you