LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Error no. 1004

HI,

I am using the sample code below to draw borders in

excel sheet from MSAccess Form.

'---------------------------------------------------------------------------
----------------------------------

Dim objXL As Excel.Application

Dim objWkb As workbook

Dim objSht As Worksheet

Set objXL = Nothing

Set objWkb = Nothing

Set objSht = Nothing

'creating new excel object

Set objXL = New Excel.Application

Set objWkb = objXL.Workbooks.Add

Set objSht = objWkb.Worksheets(1)



Range("B" & Val(lngrow + 5) & ":AE" & Val(lngrow +

32)).Select

Selection.Borders(xlDiagonalDown).LineStyle =

xlNone

Selection.Borders(xlDiagonalUp).LineStyle = xlNone

With Selection.Borders(xlEdgeLeft)

..LineStyle = xlContinuous

..Weight = xlThin

..ColorIndex = xlAutomatic

End With

With Selection.Borders(xlEdgeTop)

..LineStyle = xlContinuous

..Weight = xlThin

..ColorIndex = xlAutomatic

End With

With Selection.Borders(xlEdgeBottom)

..LineStyle = xlContinuous

..Weight = xlThin

..ColorIndex = xlAutomatic

End With

With Selection.Borders(xlEdgeRight)

..LineStyle = xlContinuous

..Weight = xlThin

..ColorIndex = xlAutomatic

End With

Selection.Borders(xlInsideVertical).LineStyle =

xlNone

Selection.Borders(xlInsideHorizontal).LineStyle =

xlNone

'---------------------------------------------------------------------------
---------------------------------

I get the borders first time, when i run next time i

am not getting borders and error occurs. but if i

close application and then run , then the borders

appear.

err number - 1004, range object failed something like that

Please help me.

TIA,

Cyrus


 
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
RT- error 1004 JMay Excel Discussion (Misc queries) 3 October 5th 08 02:58 PM
error 1004 (VBA) Harlan Grove Excel Discussion (Misc queries) 0 May 15th 06 07:33 PM
Run time error 1004, General ODBC error [email protected] New Users to Excel 0 September 19th 05 01:41 AM
Runtime error '1004' General ODBC error star_lucas New Users to Excel 0 August 29th 05 04:09 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM


All times are GMT +1. The time now is 09:39 AM.

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

About Us

"It's about Microsoft Excel"