Saving to Network share with different mappings?

  • Thread starter Thread starter Kobayashi
  • Start date Start date
K

Kobayashi

I have a shared drive that is mapped to different letters (M & N) fo
two users. However, I need both users to be able to run the below an
save the file to a folder on this share. If I qualify the share lette
- ("M:\....") I have no problems but this will then only allow on
user to run the code.

Any ideas???


myFile = ("\\Mis Reports\" & "COB" & " " & Format(CoBD, "mm.dd") & "
& "equ" _
& ".xls")
Cobbook.SaveAs Filename:=myFile


T.I.A. & Regards,

Adria
 
Let the user select the file from a list browser and use his selection of
drive paths to determine his mapping for code use:

Dim fileToOpen As String 'Users filepath
Dim fname As String 'Users filename
Dim dname As String 'Users directory name

fileToOpen = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
If fileToOpen = "False" Then 'If user clicks Cancel
Exit Sub
End If
fname = Left((Right(fileToOpen, 11)), 7)
If InStr(4, fileToOpen, "\") = 0 Then
dname = Left(fileToOpen, 3)
Else
dname = Left(fileToOpen, Application.WorksheetFunction.Find _
("\", fileToOpen, 4) -1)
End If

You will have to adjust the character count numbers in the Left & Right
functions to suit your needs. This should help get you started.
Mike
 
Mike,

Thanks, but the whole point was that I didn't want to use th
GetOpenFilename method. I don't want the user to be able to selec
where to save the file or any prompting dialogue boxes?

I want to hardcode the path, which I could do if it was mapped to th
same drive letter on all users machines, but, currently, am unable t
do if they are mapped to different letters?
Is this achievable?

Regards,

Adria
 
See one guess at your other post.
I have a similar situation !!!!! . What if we dont use the mapping letter (M & N) and use the complete server path (without mapping letter) ...would that give error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top