Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

saving to multuiple users folders 1

Status
Not open for further replies.

itsfisko

Technical User
Jan 19, 2002
226
GB
hi I have a need to write a document and simultaniously save it to multiple users work areas. Any ideas? Can it be done?
I have the admin privilages to see all these folders(pupils)and can individualy write to each in turn but to do all(150) in one go would be brill. cheers :)

Some lead, some follow....I just Hope!
 
Hi

You'll have to use some code. Assuming that you have a list of users' paths...
Code:
application.displayalerts=false
for i = lbound(MyUserList, 1) to ubound(MyUserList, 1)
  activedocument.saveas MyUserlist(i)
next
:)

Skip,
Skip@TheOfficeExperts.com
 
Sorry but it fails with (cannot run with unc path defaulting to c:) I will fiddle with the code and see what ican do thanks

Some lead, some follow....I just Hope!
 
\\server2k1\pupils\mydocuments\00001,00002,00003 etc etc
is the path required to save the docs to the user areas.
Thanks

Some lead, some follow....I just Hope!
 
Hi Skip have returned to this problem, still stuck
How do I craete the list of users, where do i put it, how do I save the script as a bat?
Any help Thanks john.

Some lead, some follow....I just Hope!
 
fisco,

Simplest way is to set up a userlist in excel with ONE WORKSHEET. My workbook name is Users.xls.

In the VB Editor (alt+F11), add a reference to Microsoft Excel in Tools/References.

.
Code:
Sub SaveToUsers()
    Dim xlApp As Excel.Application, xlUsers As Excel.Workbook
    Dim si As String
    Const ZEROS = "0000"
    
    Set xlApp = CreateObject("excel.Application")
'put the path to your excel wrokbook in here
    Set xlUsers = xlApp.workbooks.Open("C:\Documents and Settings\metzgerc\My Documents\vbaexcel\Users.xls")
    
    sPath = "\\server2k1\pupils\mydocuments\"
    i = 1
    For Each u In xlUsers.Worksheets(1).UsedRange
'si will have 0001, 0002, 0003 etc.
        Select Case i
        Case Is < 10: si = ZEROS
        Case Is < 100: s1 = Left(ZEROS, 3)
        Case Is < 1000: s1 = Left(ZEROS, 2)
        Case Is < 10000: s1 = Left(ZEROS, 1)
        End Select
        si = si & i
        With ActiveDocument
            .SaveAs sPath & si & &quot;\&quot; & u.Value & &quot;\&quot; & .Name
        End With
        i = i + 1
    Next
End Sub
Hope this helps :)

Skip,
Skip@TheOfficeExperts.com
 
testing it now will let you know how it went thanks for your help

Some lead, some follow....I just Hope!
 
SKIP :) I must be really stupid how do I do this?
Do I set up an excel sheet with all my users in a column from:- do i put the code you sent me in excel? or word?
00001 and if so how do I get the module to execute and
00002 save to the users. Sory if I seem thick but I
etc don't get it...Thanks again John
01001
01002
etc
02001
02002
etc
03001
03002

Some lead, some follow....I just Hope!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top