Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save a file to SharePoint
I know this code was working yesterday; today it is NOT working: SaveFile comes from parsing a string, as such: SaveFile = Left(imgElement.Title, 27) Here’s the code that I was using to save a file to SharePoint, and make the status of the file NOT checkedout. Dim bk As Workbook Dim APP As Excel.Application Dim obj Set bk = Workbooks(SaveFile) Set APP = bk.Parent APP.Workbooks(SaveFile).CheckIn bk.Activate bk.CheckIn Workbooks(SaveFile).Activate Workbooks(SaveFile).Save Workbooks(SaveFile).CheckIn bk.undocheckout It seems to be very simple to check in ThisWorkbook, but very difficult to checkin another file that is NOT ThisWorkbook. Any ideas on how to do this? As always, thanks! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save a file to SharePoint
On Jul 24, 2:48*pm, ryguy7272 wrote:
I know this code was working yesterday; today it is NOT working: SaveFile comes from parsing a string, as such: SaveFile = Left(imgElement.Title, 27) Here’s the code that I was using to save a file to SharePoint, and make the status of the file NOT checkedout. Dim bk As Workbook Dim APP As Excel.Application Dim obj Set bk = Workbooks(SaveFile) Set APP = bk.Parent APP.Workbooks(SaveFile).CheckIn bk.Activate bk.CheckIn Workbooks(SaveFile).Activate Workbooks(SaveFile).Save Workbooks(SaveFile).CheckIn bk.undocheckout It seems to be very simple to check in ThisWorkbook, but very difficult to checkin another file that is NOT ThisWorkbook. Any ideas on how to do this? As always, thanks! Ok, so I actually got this working and I wanted to share my code for the benefit of others: sPath = strpath & "/" & SaveFile Dim sPathTemp As String Set xlApp = New Excel.Application xlApp.Visible = True Set WB = xlApp.Workbooks.Open(sPath, , False) xlApp.Workbooks.Application.CalculateFull Application.DisplayAlerts = False buildsavedest = sPath xlApp.Workbooks(SaveFile).SaveAs buildsavedest Application.DisplayAlerts = True SaveFile is parsed, as such: SaveFile = Left(imgElement.Title, 27) That's simply the file that I'm saving. The only thing that's I'm struggling with now is to be able to undo the CheckOut Property (or set the CheckIn Property). Does anyone knwo how to do this??? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save a file to SharePoint
On Jul 24, 5:23*pm, ryguy7272 wrote:
On Jul 24, 2:48*pm, ryguy7272 wrote: I know this code was working yesterday; today it is NOT working: SaveFile comes from parsing a string, as such: SaveFile = Left(imgElement.Title, 27) Here’s the code that I was using to save a file to SharePoint, and make the status of the file NOT checkedout. Dim bk As Workbook Dim APP As Excel.Application Dim obj Set bk = Workbooks(SaveFile) Set APP = bk.Parent APP.Workbooks(SaveFile).CheckIn bk.Activate bk.CheckIn Workbooks(SaveFile).Activate Workbooks(SaveFile).Save Workbooks(SaveFile).CheckIn bk.undocheckout It seems to be very simple to check in ThisWorkbook, but very difficult to checkin another file that is NOT ThisWorkbook. Any ideas on how to do this? As always, thanks! Ok, so I actually got this working and I wanted to share my code for the benefit of others: sPath = strpath & "/" & SaveFile Dim sPathTemp As String Set xlApp = New Excel.Application xlApp.Visible = True Set WB = xlApp.Workbooks.Open(sPath, , False) xlApp.Workbooks.Application.CalculateFull Application.DisplayAlerts = False buildsavedest = sPath xlApp.Workbooks(SaveFile).SaveAs buildsavedest Application.DisplayAlerts = True SaveFile is parsed, as such: SaveFile = Left(imgElement.Title, 27) That's simply the file that I'm saving. The only thing that's I'm struggling with now is to be able to undo the CheckOut Property (or set the CheckIn Property). *Does anyone knwo how to do this???- Hide quoted text - - Show quoted text - As it turns out, this seems to do the trick: xlApp.Workbooks(SaveFile).SaveAs buildsavedest xlApp.Workbooks(SaveFile).CheckIn SaveChanges:=True, _ Comments:="" Hope this helps others… |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save a file to SharePoint
On Jul 24, 3:34*pm, ryguy7272 wrote:
On Jul 24, 5:23*pm, ryguy7272 wrote: On Jul 24, 2:48*pm, ryguy7272 wrote: I know this code was working yesterday; today it is NOT working: SaveFile comes from parsing a string, as such: SaveFile = Left(imgElement.Title, 27) Here’s the code that I was using to save a file to SharePoint, and make the status of the file NOT checkedout. Dim bk As Workbook Dim APP As Excel.Application Dim obj Set bk = Workbooks(SaveFile) Set APP = bk.Parent APP.Workbooks(SaveFile).CheckIn bk.Activate bk.CheckIn Workbooks(SaveFile).Activate Workbooks(SaveFile).Save Workbooks(SaveFile).CheckIn bk.undocheckout It seems to be very simple to check in ThisWorkbook, but very difficult to checkin another file that is NOT ThisWorkbook. Any ideas on how to do this? As always, thanks! Ok, so I actually got this working and I wanted to share my code for the benefit of others: sPath = strpath & "/" & SaveFile Dim sPathTemp As String Set xlApp = New Excel.Application xlApp.Visible = True Set WB = xlApp.Workbooks.Open(sPath, , False) xlApp.Workbooks.Application.CalculateFull Application.DisplayAlerts = False buildsavedest = sPath xlApp.Workbooks(SaveFile).SaveAs buildsavedest Application.DisplayAlerts = True SaveFile is parsed, as such: SaveFile = Left(imgElement.Title, 27) That's simply the file that I'm saving. The only thing that's I'm struggling with now is to be able to undo the CheckOut Property (or set the CheckIn Property). *Does anyone knwo how to do this???- Hide quoted text - - Show quoted text - As it turns out, this seems to do the trick: xlApp.Workbooks(SaveFile).SaveAs buildsavedest xlApp.Workbooks(SaveFile).CheckIn SaveChanges:=True, _ * * * * * * * * * * * * * * * * * * * * * * Comments:="" Hope this helps others… Got it working!! I had some help from a colleague in my office. Thanks Mandeep!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to save a WorkBook to SharePoint? | Excel Programming | |||
How to save a WorkBook to SharePoint? | Excel Programming | |||
How to save a WorkBook to SharePoint? | Excel Programming | |||
Saving files to Sharepoint site: error 1004 (can't save file) | Excel Programming | |||
Macro to Save to Sharepoint | Excel Programming |