VBA to Select Destination workbook on Sharepoint

VGuild

New Member
Joined
Jan 19, 2016
Messages
2
Hi,

Pse help! I'm very new to Macros. I have created a Purchase order that is used on site and in our office. We use sharepoint to store/use our data.
I have a command button that should update the purchase order register. However I am having trouble setting the destination workbook..... I set the destination on site as the code below, because there is only one user, but in the office we have a few and so I am having trouble rewriting this so that it accessing the sharepoint file.

This is what I have so far:

Sub UpDateLog()
Dim wb As Workbook, wbTemp As Workbook
Dim ws As Worksheet, wsTemp As Worksheet
Dim lastRow As Long


'source workbook
Set wb = ThisWorkbook
Set ws = wb.Sheets("Purchase Order Template")


'destination workbook
Set wbTemp = Workbooks.Open("C:\Users\Accounts\SharePoint\SHAMROCK CIVIL and CONCRETE P - Doc 2\Suppliers\Purchase Order Register.xlsx")

Set wsTemp = wbTemp.Sheets("Sheet1")


'Paste to next row
lastRow = wsTemp.Range("I" & Rows.Count).End(xlUp).Row + 1
ws.Range("A66:G66").Copy
wsTemp.Range("I" & lastRow).PasteSpecial Paste:=xlValues
Application.CutCopyMode = False


'Cleanup
wbTemp.Close savechanges:=True
Set wb = Nothing: Set wbTemp = Nothing
Set ws = Nothing: Set wsTemp = Nothing


End Sub

Please can someone help!!?? Thank you kindly in advance
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,213,487
Messages
6,113,937
Members
448,534
Latest member
benefuexx

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top