View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone[_2_] Jim Cone[_2_] is offline
external usenet poster
 
Posts: 1,549
Default Set a reference to a Workbook w/out opening the Workbook?

You cannot save a closed file.
You could open the file and use SaveAs to save it to another location.
Or you could use the FileCopy statement to copy the closed file to another drive.
The FileSystemObject can also be used to move/copy closed files.
How any of the above would go down in SharePoint, I don't know.

There are several SharePoint forum (web based) groups, see...
http://www.microsoft.com/office/comm...ult.mspx?CTT=3
or
http://www.aioe.org/ to access (the still alive) microsoft newsgroups.
--
Jim Cone
Portland, Oregon USA
http://tinyurl.com/ListFiles

..
..
..

"ryguy7272"
wrote in message
...
Does anyone know how to set a reference to a Workbook w/out opening
the Workbook?

I am experimenting with the code below:
SaveFile = Left(imgElement.Title, 27) '<-- This is a parsed string...
Dim sPathTemp As String
Dim BookName As String
Set xlApp = New Excel.Application
xlApp.Visible = True
'Set WB = xlApp.Workbooks.Open(sPath, , False) '< -- This opens the
file; I DON'T want to open the file
sPath = strpath & "/" & SaveFile
BookName = Mid(sPath, InStrRev(sPath, "/") + 1)
Set WB = Workbooks(Index:=BookName)

xlApp.Workbooks.Application.CalculateFull
Application.DisplayAlerts = False
buildsavedest = URL & SaveFile 'sPath
xlApp.Workbooks(SaveFile).SaveAs buildsavedest
xlApp.Workbooks(SaveFile).CheckIn SaveChanges:=True, _
Comments:=""

The code fails on this line:
xlApp.Workbooks(SaveFile).SaveAs buildsavedest

Error mssg is 'Subscript out of range'.

The files are in SharePoint. Any ideas on how to resolve this?
Thanks so much!!