![]() |
|
#1
|
|||
|
|||
![]() I'm thinking what you are trying to do would be possible, being Office and SharePoint are both Microsoft. Have you tried doing this manually once while recording a macro to see if it records the script for you? It's helped me get started on alot of scripts. |
#2
|
|||
|
|||
![]() Quote:
Sub Save_Checklist() ' ' Save_Checklist Macro ' ' ChangeFileOpenDirectory _ "https://WEBSITE/sites/WEBSITE/WEBSITE/WEBSITE/WEBSITE/Shift%20Changeover%20Brief/Completed%20Checklists/PJ/" ActiveDocument.SaveAs2 FileName:= _ "https://WEBSITE/sites/WEBSITE/WEBSITE/WEBSITE/WEBSITE/Shift%20Changeover%20Brief/Completed%20Checklists/PJ/Test%20ELECTRONIC%20(3).docx" _ , FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", _ AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, _ EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData _ :=False, SaveAsAOCELetter:=False, CompatibilityMode:=15 End Sub |
#3
|
|||
|
|||
![]() Quote:
Here's something to try. In this code, we get your current filename as a variable, and also put the output SharePoint path as it's own variable. Note that there is not trailing slash/ in the outputDirectory. I just find this easier to build strings that make sense when I put my own trailing slashes in when I use them. Finally, I used your code, swapping out some areas with the variables. If this works, it will also let you change the output directory easily since all that is done at the top of the script. Code:
Sub Save_Checklist() ' Declare some variables Dim outputDirectory As String Dim currentFilename As String Dim outputNameFull As String ' Define output name using vars currentFilename = ActiveDocument.Name outputDirectory = "https://WEBSITE/sites/WEBSITE/WEBSITE/WEBSITE/WEBSITE/Shift%20Changeover%20Brief/Completed%20Checklists/PJ" outputNameFull = (outputDirectory & "/" & currentFilename) ChangeFileOpenDirectory outputDirectory ActiveDocument.SaveAs2 FileName:=outputNameFull, _ FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", _ AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, _ EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData _ :=False, SaveAsAOCELetter:=False, CompatibilityMode:=15 End Sub |
![]() |
Tags |
macro, work |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help with Macro to Save Word File as PDF in Specific Location | ekimisme | Word VBA | 1 | 06-07-2017 10:40 PM |
![]() |
LOUF | Word VBA | 1 | 12-07-2015 06:47 PM |
Can't save a Sharepoint document in Windows 10 | Gary Tayman | Misc | 0 | 08-15-2015 04:22 PM |
![]() |
rslck | Outlook | 1 | 06-19-2014 10:16 AM |
Office 2010 - Save to Sharepoint Site | slice16 | Office | 0 | 05-11-2010 06:43 AM |