Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
RT- error 1004 | Excel Discussion (Misc queries) | |||
error 1004 (VBA) | Excel Discussion (Misc queries) | |||
Run time error 1004, General ODBC error | New Users to Excel | |||
Runtime error '1004' General ODBC error | New Users to Excel | |||
Excel 2003 Macro Error - Runtime error 1004 | Excel Discussion (Misc queries) |