Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
smilingjohn
Specialist
Specialist

Macro

HI All

Iam exporting a straight table to excel and in excel i want to colur yellow column D and Column F

how do i mention the code in the macro for this ?

My Code :

sub ExportToExcel_Ration

Dim CLApp, XLDoc,XLSheet

  set XLApp = CreateObject("Excel.Application") ' Define Object

  XLApp.Visible = True 'Visible set as true

  set XLDoc = XLApp.Workbooks.Add 'Open new workbook

  set XLSheet = XLDoc.Worksheets.Add

  ActiveDocument.GetSheetObject("CH04").CopyTableToClipboard TRUE

  XLSheet.paste

XLSheet.Name="Ration"

End Sub

Thanks in Advance

3 Replies
Gysbert_Wassenaar

That's a vbscript question, not a qlikview question. Try this article: An example of using a VBS script to create, populate and format an Excel document | Geeks Hangout:

'Change the background colour of column A to a light yellow

objExcel.Columns(1).Interior.ColorIndex = 36


talk is cheap, supply exceeds demand
smilingjohn
Specialist
Specialist
Author

Hi Gysbert

I tired it it now working

Iam using the same macro what i posted above and to that in the last row i added ur code but its not running

Gysbert_Wassenaar

Of course it won't run if you blindly copied that line. Your code doesn't create an object with the name objExcel.


talk is cheap, supply exceeds demand