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 Column..._Global failed error


I'm currently creating an excel document via an Access 2003 Module.
I write the xls fine yet when I go to format the xls I get th
following
"Method 'Columns' of object '_Global' failed"... How do I create an
object to use the column?

If you sroll down you'll find this:

'''''''''''''''''''''' Here's where it break
'''''''''''''''''''''''''''''''''

that's where the problems begin... Any help will be greatl
appreciated.

Thanks.

Sean

Option Compare Database

Sub CreateReport()

Set xlApp = New Excel.Application
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Sheets(1)
xlApp.Visible = True

With xlSheet

.Range("A1") = "Analyst"
.Range("B1") = "Program Description"
.Range("C1") = "$"
.Range("D1") = "PCO/OS"
.Range("E1") = "Program Manager/OS"
.Range("F1") = "Best Value Methodology"
.Range("G1") = "RFP Release"
.Range("H1") = "Comp Range"
.Range("I1") = "Decision Brief"
.Range("J1") = "Award"
.Range("K1") = "Status/Comments(FPR, award, protest, etc"
.Range("L1") = "Estimated SS Facility Need Date"

End With

Dim strSQL As String
Dim strSQL2 As String
Dim RS As ADODB.Recordset
Set RS = New ADODB.Recordset
Dim RS2 As ADODB.Recordset
Set RS2 = New ADODB.Recordset

Dim RecCount As Integer

strSQL = "SELECT [All Data].SSEA, [All Data].ProgramName
[All Data].EstDollars, [All Data].PCO, [All Data].PCOOS, [All Data].PM
[All Data].PMOS, [All Data].BVSSEA, [All Data].BVMETHOD, [Al
Data].RFPDate, [All Data].MSCompRang, [All Data].MSDecision, [Al
Data].AdateAward, [All Data].ID, CurrentStatus.Date
CurrentStatus.Status, CurrentStatus.strCurrent FROM [All Data] INNE
JOIN CurrentStatus ON [All Data].Id = CurrentStatus.ProgramID WHER
(((CurrentStatus.strCurrent)='-1'));"
RS.Open strSQL, CurrentProject.Connection, adOpenStatic

'CurrRec = RS("ID")
'strSQL2 = "SELECT Date_tbl.* FROM Date_tbl WHER
(((Date_tbl.ProgramID)=" & CurrRec & "))"
'And ((Date_tbl.Current=true));"
'RS2.Open strSQL2, CurrentProject.Connection, adOpenStatic


RecCount = RS.RecordCount


Dim CoreCells(10)

CoreCells(0) = "A"
CoreCells(1) = "B"
CoreCells(2) = "C"
CoreCells(3) = "D"
CoreCells(4) = "E"
CoreCells(5) = "F"
CoreCells(6) = "G"
CoreCells(7) = "H"
CoreCells(8) = "I"
CoreCells(9) = "J"
CoreCells(10) = "K"


k = 2

For i = 1 To RecCount

Dim CellValue(10)

CellValue(0) = RS![SSEA]
CellValue(1) = RS![ProgramName]
CellValue(2) = RS![EstDollars]
CellValue(3) = RS![PCO] & "/" & RS![PCOOS]
CellValue(4) = RS![PM] & "/" & RS![PMOS]
CellValue(5) = RS![BVMethod]
CellValue(6) = RS![RFPDate]
CellValue(7) = RS![MSCompRang]
CellValue(8) = RS![MSDecision]
CellValue(9) = RS![AdateAward]
CellValue(10) = RS![Status]



For j = 0 To UBound(CoreCells)

Cellval = CoreCells(j)
k

With xlSheet
.Range(Cellval)
CellValue(j)
End With


Next j




RS.MoveNext
k = k + 1
Next i

Set RS = Nothing

'''''''''''''''''''''' Here's where it break
'''''''''''''''''''''''''''''''''

Columns("A:N").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

With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With

With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With

Cells.EntireColumn.AutoFit
Columns("N").ColumnWidth = 60.11
Columns("N").WrapText = True

Range("A1").Select


'''''''''''''''''''''''''''''''''''''''''''''''''' '''''

End Su

--
syuha
-----------------------------------------------------------------------
syuhas's Profile: http://www.excelforum.com/member.php...o&userid=27486
View this thread: http://www.excelforum.com/showthread...hreadid=472171

 
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
runtime error 1004 method range of object '_global failed valdesd Excel Discussion (Misc queries) 2 October 6th 05 07:26 PM
runtime error '1004' object '_Global' failed Jim in Spokane[_2_] Excel Programming 0 August 3rd 05 12:16 AM
<Method 'Range' of object '_Global' failed error Ken Loomis Excel Programming 2 October 12th 04 01:29 PM
Runtime Error 1004 - Method Range of '_Global failed' Sworkhard Excel Programming 3 July 9th 04 04:20 AM
Error 1004: Method 'Cells' of object '_Global' failed LT Excel Programming 2 October 31st 03 04:47 PM


All times are GMT +1. The time now is 03:10 PM.

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"