Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Set a reference to a Workbook w/out opening the Workbook?

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!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Set a reference to a Workbook w/out opening the Workbook?

On Jul 26, 12:19*am, ryguy7272 wrote:
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!!



I alse experimented with this:
Dim xlApp As Object
Set xlApp = New Excel.Application
xlApp.Visible = True
sPath = strpath & "/" & SaveFile
BookName = Mid(sPath, InStrRev(sPath, "/") + 1)
Set xlApp = GetObject(pathname:=sPath)
xlApp.Windows(BookName).Visible = True
xlApp.Workbooks.Application.CalculateFull
Application.DisplayAlerts = False
buildsavedest = URL & SaveFile 'sPath
xlApp.Workbooks(SaveFile).SaveAs buildsavedest
xlApp.Workbooks(SaveFile).CheckIn SaveChanges:=True, _
Comments:=""

This gives me an error on this line:
Set xlApp = GetObject(pathname:=sPath)

Erorr is: 'Automation error. Invalid syntax'
Perhaps 'GetObject' doesn't work with URLs... The files are stored
inSharePoint.

Any advice anyone??? Thanks!!!
  #3   Report Post  
Posted to microsoft.public.excel.programming
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!!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Set a reference to a Workbook w/out opening the Workbook?

On Jul 26, 10:37*am, "Jim Cone" wrote:
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
orhttp://www.aioe.org/to access (the still alive) microsoft newsgroups.
--
Jim Cone
Portland, Oregon *USAhttp://tinyurl.com/ListFiles

.
.
.

"ryguy7272"
wrote in ...
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!!



But the file is open; I just want to reference the open file, then
save it. This is going to require some hard-cord out-of-the-box-
thinking.
Thanks Jim!!!
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Set a reference to a Workbook w/out opening the Workbook?

On Jul 26, 8:13*am, ryguy7272 wrote:
On Jul 26, 10:37*am, "Jim Cone" wrote:



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/com...ult.mspx?CTT=3
orhttp://www.aioe.org/toaccess (the still alive) microsoft newsgroups.
--
Jim Cone
Portland, Oregon *USAhttp://tinyurl.com/ListFiles


.
.
.


"ryguy7272"
wrote in ...
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!!


But the file is open; I just want to reference the open file, then
save it. *This is going to require some hard-cord out-of-the-box-
thinking.
Thanks Jim!!!


Got it working!! I had some help from a colleague in my office.
Thanks Mandeep!!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
lost reference to activesheet when opening workbook inside IE vsiat Excel Programming 1 February 8th 08 02:57 PM
when opening an Excel Workbook, another blank workbook also opens spmu Excel Discussion (Misc queries) 0 October 12th 07 01:46 PM
How to make the opening of a workbook conditional upon the opening of another workbook Marcello do Guzman Excel Programming 1 December 16th 03 06:09 AM
How to make opening of workbook conditional of opening of another workbook turk5555[_2_] Excel Programming 2 December 15th 03 11:07 PM
Question for Experts: Opening workbook with workbook references Chris Excel Programming 0 September 11th 03 07:05 PM


All times are GMT +1. The time now is 07:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"