Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Error LineStyle property of Border Class

I am trying to format a pivot table after it is refreshed. I have the
following code which causes an error on the first Selection.Borders line
where I clear the grid.

Range("A5:AO600").Select ' Set borders

Selection.Interior.ColorIndex = xlNone ' Remove fill

Selection.Borders(xlDiagonalDown).LineStyle = xlNone ' Clear the grid
Selection.Borders(xlDiagonalUp).LineStyle = xlNone

The error is Runtime Error 1004. Unable to set the LineStyle property of
the Border class.

I am running Access 2007 but tried it on Access 2003 with the same result.
While I have been working on the file, I am sure I have not touched this
code, and it did work in the past. Any suggestions?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Error LineStyle property of Border Class

If you are automating Excel from Access I'm surprised your code even gets
that far, would need to qualify all your objects back to your reference to
Excel.

However running the code snippet as is in Excel might fail if the sheet is
protected.

In passing, it's rarely necessary to use Select, eg

Dim rng as Range '
' Dim rng as Excel.Range ' in Access with early binding
' Dim rng as Object ' in Access with late binding

Set rng = Activesheet.Range(("A5:AO600") ' in Access prefix with xlApp.etc
rng..Interior.ColorIndex = xlNone ' etc

Regards,
Peter T

"NevilleT" wrote in message
...
I am trying to format a pivot table after it is refreshed. I have the
following code which causes an error on the first Selection.Borders line
where I clear the grid.

Range("A5:AO600").Select ' Set borders

Selection.Interior.ColorIndex = xlNone ' Remove fill

Selection.Borders(xlDiagonalDown).LineStyle = xlNone ' Clear the

grid
Selection.Borders(xlDiagonalUp).LineStyle = xlNone

The error is Runtime Error 1004. Unable to set the LineStyle property of
the Border class.

I am running Access 2007 but tried it on Access 2003 with the same result.
While I have been working on the file, I am sure I have not touched this
code, and it did work in the past. Any suggestions?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Error LineStyle property of Border Class

Actually running the code within Excel. Not using Access.

"Peter T" wrote:

If you are automating Excel from Access I'm surprised your code even gets
that far, would need to qualify all your objects back to your reference to
Excel.

However running the code snippet as is in Excel might fail if the sheet is
protected.

In passing, it's rarely necessary to use Select, eg

Dim rng as Range '
' Dim rng as Excel.Range ' in Access with early binding
' Dim rng as Object ' in Access with late binding

Set rng = Activesheet.Range(("A5:AO600") ' in Access prefix with xlApp.etc
rng..Interior.ColorIndex = xlNone ' etc

Regards,
Peter T

"NevilleT" wrote in message
...
I am trying to format a pivot table after it is refreshed. I have the
following code which causes an error on the first Selection.Borders line
where I clear the grid.

Range("A5:AO600").Select ' Set borders

Selection.Interior.ColorIndex = xlNone ' Remove fill

Selection.Borders(xlDiagonalDown).LineStyle = xlNone ' Clear the

grid
Selection.Borders(xlDiagonalUp).LineStyle = xlNone

The error is Runtime Error 1004. Unable to set the LineStyle property of
the Border class.

I am running Access 2007 but tried it on Access 2003 with the same result.
While I have been working on the file, I am sure I have not touched this
code, and it did work in the past. Any suggestions?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: Cannot Set Range Class Property 2hOt Excel Programming 2 August 1st 06 12:52 PM
VBA error: Unable to set the Values property of the Series class Marco Shaw Excel Programming 2 July 13th 05 03:40 PM
VBA error: Unable to set the Values property of the Series class Marco Shaw Charts and Charting in Excel 1 July 12th 05 02:34 PM
Error: Unable to get the OLEObjects property of the worksheet class Grant Excel Programming 2 August 6th 04 02:20 PM
Unable to set the colorIndex Property of the Interior Class Error GriffyGriff Excel Programming 3 October 3rd 03 04:37 PM


All times are GMT +1. The time now is 04:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"