copy active document to shared network drive
Hi,
I have to copy the active document in shared network drive
I am using this macro, it is giving the error access denied.
But read and write permissions are there for this folder.
Please advice
Appreciate your help
Private Function access_Network_share()
On Error GoTo ErrHandler
ServerShare = "\\USER1-PC\MetaData"
userName = txtUserName.Text
Password = txtPassword.Text
Set NetworkObject = CreateObject("WScript.Network")
NetworkObject.MapNetworkDrive "", ServerShare, False, userName, Password
save_As_word
NetworkObject.RemoveNetworkDrive ServerShare, True, False
Set NetworkObject = Nothing
Exit Function
ErrHandler:
MsgBox "Please check your credentials"
End Function
Private Function save_As_word()
On Error GoTo ErrHandler
Kill "D:\Metadata\" & (ActiveDocument.Name) & ".DOCX"
ActiveDocument.SaveAs "\\USER1-PC\MetaData\" & (ActiveDocument.Name)
Exit Function
ErrHandler:
End Function
Regards,
Rose
|