![]() |
|
#1
|
|||
|
|||
![]()
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 |
#2
|
||||
|
||||
![]()
Have you checked where the code is generating the error? For example, I doubt this line would work:
Kill "D:\Metadata\" & (ActiveDocument.Name) & ".DOCX" since ActiveDocument.Name will return the Active Document's name, including the extension...
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
Hi Paul,
Thanks, sorry Kill "D:\Metadata\" & (ActiveDocument.Name) & ".DOCX" actually I have commented. This issue need to fix urgently, using net use when we are copying able to copy. Is it because I am using saveus, if i use copyfile will it be ok ActiveDocument.SaveAs "\\USER1-PC\MetaData\" & (ActiveDocument.Name) is throwing the error as access denied. Appreciate your help Thanks& Regards, Rose |
#4
|
||||
|
||||
![]()
From what I can see of your MapNetworkDrive method implementation, you've omitted the Drive name you want to map the server to. AFAIK, you need to map it to an available drive letter, which you then use for the Save As.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
![]()
Hi Paul,
Thanks for sharing, as per the user requirement cannot map the drive due to security. only given share drive " "\\USER1-PC\MetaData\"" authenticate and copy the file Thanks & Regards, Rose |
#6
|
||||
|
||||
![]()
If you cannot map the drive, then why are you using the MapNetworkDrive method?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
![]()
Hi Paul,
For the same code today I am getting error 4198 -command failed. please advice Thanks & Regards, Rose |
#8
|
||||
|
||||
![]()
These really aren't Word issues - they're more related to Windows and, more specifically, networking, neither of which are my particular area of expertise. That said, you're not using the MapNetworkDrive method properly (i.e. you're not specifying a drive letter to map to) and you still haven't answered my question as to you're using the MapNetworkDrive method when you say there is a "user requirement cannot map the drive due to security".
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
|||
|
|||
![]()
Hi Paul,
Sorry just a beginner, want to check is there any way to save the active document in shared network drive by authentication with out mapping? Thanks & Regards, Rose |
#10
|
||||
|
||||
![]()
That shouldn't be any different than saving to a local drive. If the network drive is shared, it's presumably already mapped to an alias (e.g. H: ) and you should be able to use that. Indeed, you should even be able to save direct to \\USER1-PC\Metadata.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Live updating powerpoint playing on network drive | flossin345 | PowerPoint | 0 | 10-10-2013 09:50 AM |
![]() |
aldo4u | Word | 7 | 07-24-2013 07:56 AM |
![]() |
robbid01 | Office | 1 | 01-05-2012 03:47 PM |
Hyperlinking files on a mapped network drive | howler2345 | Outlook | 0 | 12-21-2011 08:54 AM |
Mail Merge and Files on Network Drive | Joe Switch | Mail Merge | 0 | 09-15-2011 09:06 AM |