I have an urgent question: how do you automatically save all documents “for all users”. Is there a script for this?
I have to import al lot of documents and save them for all users somewhere on disk.
So a combination of "Save all " and “save for all users”
Sub SaveAllForAll()
On Error GoTo Error_Handler
Dim strSavePath As String
strSavePath = "C:\Program Files\Business Objects"
Dim Success As Boolean
Dim doc As Object
Dim i As Integer
For i = 1 To Application.Documents.Count
Success = Application.Documents(i).SaveAs(strSavePath & "\" & Application.Documents(i).Name, 1)
If Not Success Then
' MsgBox (Application.Documents(i).Name & " did not save.")
End If
Next
Exit Sub
Error_Handler:
Success = MsgBox(Err.Description, vbCritical)
End Sub
Here is a small utility (attached below) that should do the trick.
Instructions for use:
Place all documents, along with the utility, in a separate sub-directory.
Open the utility, press Alt-F8, select the SaveForAllUsers macro, and click Run.
Macro will sequentially open all .rep files in the directory and perform a “save for all users” on each.
The code is in the utility, but I will include it here for reference:
Sub SaveForAllUsers()
Dim PathName As String
Dim RptName As String
Dim Doc As Document
PathName = ThisDocument.Path & "\"
RptName = Dir(PathName & "*.rep")
Do While RptName <> ""
RptName = PathName & RptName
If RptName <> ThisDocument.FullName Then
Set Doc = Application.Documents.Open(RptName, True, False)
Call Doc.SaveAs(RptName, True) 'true is the "save for all users" flag
Call Doc.Close
End If
RptName = Dir
Loop
End Sub