![]() |
getURL or open
I have this code that stops when I try to copy the Excel sheet from the
sharepoint SErver to my local desktop. It asks me for the username and login however when I go to the web site in my browser I can download the excel spreadsheet without a user name and password. Am I supposed to use another VBA command like getURL instead of open? I need a copy on my desktop. I can get the password and login but I want to make sure the code is right. Thanks, -----------------code-------- Sub CopySheet() Dim sharePointURL As String Dim objExcel, objWorkbook, objWorksheet As Object sharePointURL = "http://vsps/sites/QEG/default.aspx" reportTitle = "HSI Capacity Report" reportDate = "07-0630" filePath = "c:\\Temp\Segmentation" Set objExcel = CreateObject("Excel.Application") Set objWorkbook = objExcel.Workbooks.Open(sharePointURL) objExcel.Visible = True Set objWorksheet = objWorkbook.Worksheets("Port History") objWorksheet.Copy ActiveWorkbook.SaveAs Filename:=filePath & reportDate & " " & reportTitle 'ActiveWorkbook.Close End Sub |
getURL or open
I got a run-time error on this so I will re-post SORRY.
"Janis" wrote: I have this code that stops when I try to copy the Excel sheet from the sharepoint SErver to my local desktop. It asks me for the username and login however when I go to the web site in my browser I can download the excel spreadsheet without a user name and password. Am I supposed to use another VBA command like getURL instead of open? I need a copy on my desktop. I can get the password and login but I want to make sure the code is right. Thanks, -----------------code-------- Sub CopySheet() Dim sharePointURL As String Dim objExcel, objWorkbook, objWorksheet As Object sharePointURL = "http://vsps/sites/QEG/default.aspx" reportTitle = "HSI Capacity Report" reportDate = "07-0630" filePath = "c:\\Temp\Segmentation" Set objExcel = CreateObject("Excel.Application") Set objWorkbook = objExcel.Workbooks.Open(sharePointURL) objExcel.Visible = True Set objWorksheet = objWorkbook.Worksheets("Port History") objWorksheet.Copy ActiveWorkbook.SaveAs Filename:=filePath & reportDate & " " & reportTitle 'ActiveWorkbook.Close End Sub |
All times are GMT +1. The time now is 03:54 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com