Saving Excel file held on sharepoint site

Mike UK

New Member
Joined
Dec 14, 2011
Messages
43
Hi - I have a excel log file held on a sharepoint site which is triggered when an excel work book is opened. The log file merely logs the username and date / time opened. I can get the file to open and populate the user name and and date /time. However when I close the file it opens the Save As Dialogue box. When you select Save it says that the file already exists and would you like to overwrite the file.

I want to suppress the Save as screen and overwrite file dialogue boxes so it happens automatically. Ideally I want all the logging to occur in the background so the user doesn't see any of this happening.

The code is as follows:-
Sub Workbook_Open()

LogDetails 'Calls subroutine to log username and date


End Sub

Sub LogDetails()
Dim LR As Long

Application.ScreenUpdating = False
Application.DisplayAlerts = False

Workbooks.Open Filename:="http://filepath/filepath/Log%20for%20Annual%20Statement.xlsx"

Workbooks("Log for Annual Statement.xlsx").Activate
Worksheets("Log").Activate
LR = Range("A" & Rows.Count).End(xlUp).Row

Sheets("Log").Cells(LR + 1, 1) = (Environ$("Username"))
Sheets("Log").Cells(LR + 1, 2) = Now()



ActiveWorkbook.Close savechanges:=True
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub


Any ideas?
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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