Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
PFa
sub ExportExcel()
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = true
Set xlDoc = xlApp.Workbooks.Add()
filePath = "D:\qv\export.csv"
'Create the new sheet and the content in the sheet
Set xlSheet = xlDoc.Worksheets.Add
xlSheet.Name = "SheetFromExcel"
xlSheet.Range("A1").Value = "DataHeader"&getVariable("vTodayDate1")&" N *"
xlSheet.Range("A1").EntireColumn.ColumnWidth = 36
xlSheet.Range("A2").Value = "*AppHeader"&getVariable("vTodayDate")&" Test@test.com"
Set SheetObj = ActiveDocument.GetSheetObject("myChart")
SheetObj.CopyTableToClipboard true
xlSheet.Paste xlSheet.Range("B3")
xlSheet.Range("A"&getVariable("vCount")+4).Value = "* end trailer abcdef "&getVariable("vCount")
xlSheet.Range("A"&getVariable("vCount")+5).Value = "End Test"
xlSheet.SaveAs filePath
xlApp.Quit
End sub
function getVariable(varName)
set v = ActiveDocument.Variables(varName)
getVariable = v.GetContent.String
end function