Run Time Error

M

Markus

I have a file that when macros are enabled provides me
with a "Run Time Error 5". When I debug it takes me to a
line of code that reads
Set wb = Workbooks.Open("U:\Quality Team\QA MAIN\Analysis
and ReportsLG KL GN\Corporate Excel Reports\QARP2004
\ProgramReports\PG1Rep2004.xls")

The path is correct.

Here is the complete sub

Private Sub Workbook_Open()

Dim wb As Workbook
Dim lngColor As Long
lngColor = RGB(221, 221, 221)
ActiveWorkbook.Colors(16) = lngColor
Sheets("SR").Select
Application.Goto Reference:=Worksheets("Front").Range
("A1"), Scroll:=True
Application.CommandBars("Formatting").Visible = False
Application.CommandBars("Borders").Visible = False
Application.CommandBars("Chart").Visible = False
Application.CommandBars("Control ToolBox").Visible = False
Application.CommandBars("Drawing").Visible = False
Application.CommandBars("Clipboard").Visible = False
Application.CommandBars("External Data").Visible = False
Application.CommandBars("Forms").Visible = False

Application.CommandBars("Picture").Visible = False
Application.CommandBars("PivotTable").Visible = False

Application.CommandBars("Reviewing").Visible = False

Application.CommandBars("Visual Basic").Visible = False

Application.CommandBars("Web").Visible = False
Application.CommandBars("WordArt").Visible = False
Application.CommandBars("Standard").Visible = True

Application.ScreenUpdating = False ' turn off the screen
updating
Set wb = Workbooks.Open("U:\Quality Team\QA MAIN\Analysis
and ReportsLG KL GN\Corporate Excel Reports\QARP2004
\ProgramReports\PG1Rep2004.xls")
With ThisWorkbook.Worksheets("Front")
..Range("A8").Value = wbz.Worksheets("Objectives").Range
("F2").Value

wb.Close False
Application.ScreenUpdating = True ' turn on the screen
updating

End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top