Manipulating Excel with LotusScript - question

Hi - I’ve done this before but it has been a long time, and I can’t remember the details of how I did it before. What I’m trying to do is simply output data that I’ve collected from Notes databases into an Excel spreadsheet, then do some simple formatting. The output works great. Now the formatting code is giving me grief - I am getting the following errors:

  1. “Variable is not declared: RANGE” (though if I put .Range with a period before it, that seems to take)

  2. “Variable is not declared: SELECTION”

  3. “Variable is not declared: ACTIVECELL”

Thanks for looking - any help or useful examples appreciated!

Trish

Const APPLICATION_EXCEL = "Excel.Application"

Const SHEET_1 = "Sheet1"

Const xlContinuous = 1

Const xlR1C1 = 2

Const xlCenter = -4108

Const xlBottom = -4107

Const xlGeneral = 1

Const xlContext = -5002



Set xlapp = CreateObject(APPLICATION_EXCEL)

xlapp.Visible = False

xlapp.Workbooks.Add

xlapp.ReferenceStyle = xlR1C1

xlapp.DisplayAlerts = False

Set xlsheet = xlapp.Workbooks(1).Worksheets(1)

xlsheet.Name = "DA Monthly Report"



Range("A1:K1").Select ' <----------#1

With Selection ' <-----------#2

	.HorizontalAlignment = xlCenter

	.VerticalAlignment = xlBottom

	.WrapText = False

	.Orientation = 0

	.AddIndent = False

	.IndentLevel = 0

	.ShrinkToFit = False

	.ReadingOrder = xlContext

	.MergeCells = False

End With

Selection.Merge

ActiveCell.FormulaR1C1 = "DA Monthly Report" ' <----#3

.Range("A1:K1").Select

Selection.Font.Bold = True

.Range("A3:K3").Select

Subject: Manipulating Excel with LotusScript - question

Range, selection and ActiveCell are all properties of the application I believe, so use:

xlapp.range(…).Select

with xlapp.selection

xlapp.activecell…

Not 100% sure about the activecell one, but try it

Dan

Subject: RE: Manipulating Excel with LotusScript - question

THAT DID IT! Thanks, Dan! Once I read your response I thought, “Oh, I knew that!” Thanks for the reminder! It has been such a long time since I’ve needed that info…

BTW I always love it when you answer my questions!!!

Thanks again,

Trish