Friday, February 19, 2010

Excel Export - a Lotus script reference code fragment

Fragment of lotus script code that shall help you get a clear idea of how to export stuffs from lotus notes to excel 

Note: For more info on manipulation using excel objects, you can go through the following site, which holds the complete dom information on excel object:
http://msdn.microsoft.com/en-us/library/syyd7czh%28VS.80%29.aspx

  Dim excelObj As Variant
    On Error Goto errHandler
   
    Set excelObj=createObject("Excel.Application")
    Call excelObj.Application.workbooks.open("C:\Documents and Settings\karthikeyan_a\Desktop\Dashboard.xls")
    Call excelObj.ActiveSheet.ChartObjects("Chart 2").Activate
    Call excelObj.ActiveChart.ChartArea.Copy
   
    excelObj.Range("F3").Select
    'give values between 0 to 100 and see the difference in the image being produced
    excelObj.ActiveCell.FormulaR1C1 = chartValue
   
    excelObj.Range("H2").Select
    'give the graph title
    excelObj.ActiveCell.FormulaR1C1 = chartTitle
   
    excelObj.activeworkbook.save
    excelObj.activeworkbook.close(True)
    excelObj.quit
   
    Call uidoc.GotoField(rtFieldName)
    Call uidoc.Paste
    Call uidoc.GotoField(rtFieldName)
   
    Exit Function
errHandler:
    Msgbox Error,,Cstr(Erl) & " Clear Graph function"
    Exit Function

No comments:

Post a Comment