sullisnyc44
asked on
File Save As saving to last file location, not SharePoint doc library, custom Save As button, Enble Macros
1. I have a SharePoint 2007 doc library with a custom content type - an xlsm.
I have this code that runs before Save:
How do I insert the path of the SharePoint Library? This code saves to the last know save as file location.
2. Also, I want a custom Save and Close button that will save the spreadsheet as a regular xlsx and then close excel. Either a button on the sparesheet or the Ribbon (only for this workbook)
3. I want to enable macros for this workbook when it is opened. Can I do it with a prompt? right now I have a highlighted cell that says ' hey enable macros!!' . Not so fabulous solution. :)))
I have this code that runs before Save:
Sub SaveByDate()
Dim MyYear As String
Dim MyMonth As String
Dim MyDay As String
Dim MyHour As String
Dim MyMin As String
Dim MySec As String
Dim MyFileName As String
MyYear = Year(Date)
MyMonth = Right("0" & Month(Date), 2)
MyDay = Right("0" & Day(Date), 2)
MyHour = Right("0" & Hour(Time), 2)
MyMin = Right("0" & Minute(Time), 2)
MySec = Right("0" & Second(Time), 2)
MyFileName = "PO_" & MyYear & MyMonth & MyDay & "-" & MyHour & MyMin & MySec
ActiveWorkbook.SaveAs Filename:=MyFileName
End Sub
How do I insert the path of the SharePoint Library? This code saves to the last know save as file location.
2. Also, I want a custom Save and Close button that will save the spreadsheet as a regular xlsx and then close excel. Either a button on the sparesheet or the Ribbon (only for this workbook)
3. I want to enable macros for this workbook when it is opened. Can I do it with a prompt? right now I have a highlighted cell that says ' hey enable macros!!' . Not so fabulous solution. :)))
ASKER
Do you know how I can make this a Trusted Location?
ASKER
how about a custom button for saving? Save as a regular excel sheet...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
FWIW, a quick search indicates you simply add the server URL when saving:
ActiveWorkbook.SaveAs Filename:="http://server_url_here/" & MyFileName
ASKER
like your file name shortened! thanks
I did not want to hard code the URL if I did not have to...
I will repost in sharepoint minus excel and see what happens. thanks
I did not want to hard code the URL if I did not have to...
I will repost in sharepoint minus excel and see what happens. thanks
ASKER
partially helped. did not answer sharepoint issues
Bit of a punt, but can you use:
ActiveWorkbook.SaveAs Filename:=activeworkbook.path & "\" & MyFileName
I know nothing about Sharepoint so can't comment about that.