excel format from access vba

spinkung

Registered User.
Local time
Today, 07:11
Joined
Dec 4, 2006
Messages
267
Hi All,

I'm trying to set some borders in excel using access VBA.

i've got...
Code:
xlsht1.Rows("1:1").Select
With [COLOR="Red"]selection.Borders(xlEdgeLeft)[/COLOR]
    .LineStyle = xlContinuous
    .ThemeColor = 1
    .Weight = xlThin
End With

.. but i keep getting an error message saying object required at the red section of my code???

anyone?? thanks, spin.
 
Try:

Code:
xlsht1.Rows("1:1").Select
With [b]xlsht1.[/b]selection.Borders(xlEdgeLeft)
    .LineStyle = xlContinuous
    .ThemeColor = 1
    .Weight = xlThin
End With
 
Hi All,

I'm trying to set some borders in excel using access VBA.

i've got...
Code:
xlsht1.Rows("1:1").Select
With [COLOR=red]selection.Borders(xlEdgeLeft)[/COLOR]
    .LineStyle = xlContinuous
    .ThemeColor = 1
    .Weight = xlThin
End With

.. but i keep getting an error message saying object required at the red section of my code???

anyone?? thanks, spin.

Beyond what HiTechCoach said I would also recommend removing the excel manipulation from access altogether. Access doesn't play nice with excel all the time. You will occasionally run into problems where Access can't find the handle for excel and then spits out some error indicating that the global reference can not be accessed or something like that. I would recommend building the excel macro in excel and then using a "xlsht1.run" command from Access. This will spare you quite a bit of frustration.
 
thanks both for the advice.

HiTech : your code worked fine thanks.

Joh : I'll try your approach but i then i have to mail out the spreadsheet and i wanted it to be macro free. Is it worth setting up another spreadsheet to format it or is that going too far??

Thanks, spin.
 

Users who are viewing this thread

Back
Top Bottom