runtime error '1004' application or object defined error

G

Guest

Could this be a problem with using open on a sharepoint site or do I have
something wrong with an object? Since it is a run-time error it doesn't tell
me exactly what to look for .
thanks,


Option Explicit
Private reportTitle, filePath, reportDate As String

'Copies Excel spreadsheet from http://vsps02/sites/default.aspx/Capacity
Managmenet/Weekly Report/


Sub CopySheet()
Dim sharePointURL As String
Dim objExcel, objWorkbook, objWorksheet As Object
sharePointURL = "http://vsps02/sites/default.aspx"
reportTitle = "Capacity Report"
reportDate = "07-0630"
filePath = "c:\\Temp\Segmentation"



Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open(filePath & reportDate & " " &
reportTitle)
objExcel.Visible = True

Set objWorksheet = objWorkbook.Worksheets("Port History")
objWorksheet.Copy

ActiveWorkbook.SaveAs Filename:=filePath & reportDate & " " & reportTitle
'ActiveWorkbook.Close
End Sub
 
G

Guest

Thanks, I read your web page. I didn't know that dim var x,y,z as string
was not the same as
dim var x as string
dim var y as string
dim var z as string
that seems logical that they would be the same thing
thanks again
 

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