Error on Code

M

Markus

I get this error when I run the code below. Any way to fix
this?

Run Time Error 1004
Method 'Open' of object 'Workbooks' failed

it then Highlights the WorkBook.Open Section of the code.

Sub CB1_Click()

Dim wb As Workbook

Application.ScreenUpdating = False ' turn off the
screen updating
Set wb = Workbooks.Open("H:\My
Documents\WorkInProgress\QARP2004
\ProgramReports", "PG1Rep2004.xls", True, True)
' open the source workbook, read only
With ThisWorkbook.Worksheets("SR")
' read data from the source workbook
.Range("A8").Formula = wb.Worksheets
("EvaluationCalculator").Range("D1").Formula
End With
wb.Close False ' close the source workbook without
saving any changes
Application.ScreenUpdating = True ' turn on the screen
updating
End Sub
 
R

Ron de Bruin

Hi Markus

Your file path and name must be together

"H:\My Documents\WorkInProgress\QARP2004\ProgramReports\PG1Rep2004.xls"
 
F

Frank Kabel

Hi Markus
try

Workbooks.Open
"H:\MyDocuments\WorkInProgress\QARP2004\ProgramReports\PG1Rep2004.xls"
set wb = activeworkbook
 

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

Similar Threads


Top