VBA excel formatting properties not accessable

D

dp

Hi everyone:

I am a newbie to Excel programming. I am a MS Access programmer. I am
using Office 2003.

I am trying to export a query to excel and have found many excellent code
hints from this users group.

However, I am having a hard time getting 2 things to work:

1. formatting cells with gridlines, bold, etc

I guess because I am using no Excel library reference, I am declaring all
objects as Variances. therefore it cannot find certain properties like
formatting.

here is my code

With xls.Range(xls.Cells(intNumRows + 4, icolArr),
xls.Cells(intNumRows + 4, icolArr).Address) ' row position
'Set rng = xls.Range(xlc.Cells(2, 1), xlc.Cells(intNumRows + 4,
intNumCols).Address)
Set rng = xls.Range(xls.Cells(2, icolArr), xls.Cells(intNumRows,
icolArr).Address) ' range of cells to sum
.Borders(0).Weight = 2 ' **bombs here
.Formula = "=dollar(Sum(" & rng.Address & "),2)"
End With
Next

So, if I import the excel library, will users have reference problems if I
try to package my ms access MDE file if they dont have excel 2003 library?
Curious.

2. merging cells and then resuming the cell offsetting

Here is my code:

' Merge row
xls.Range("A1:A10").Resize(1, 2).select
selection.MergeCells = True

xlc.Cells(1, 1).Value = sReportTitle

Set xlc = xlc.Offset(2, 0) ' wont resume to the next row here

maybe i need a "deselect" code, dunno

Any help would be appreciated,
cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top