Hi,
Is it possible to tell VBA to use a different domain user account to save a document that isn't the account for the logged on current domain user.
The server guys set permissions on the server share to not allow 'delete' permissions so users couldn't move / delete folders or files, only the VBA code then couldn't create a new word document from a memory resident mail merge.
The last line that tries to save the document fails once 'delete' permissions have been removed from the user.
How do I get round this?
Can I set the account to use when trying to save the document?
Thanks,
1DMF
"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Dance Music Downloads
Is it possible to tell VBA to use a different domain user account to save a document that isn't the account for the logged on current domain user.
The server guys set permissions on the server share to not allow 'delete' permissions so users couldn't move / delete folders or files, only the VBA code then couldn't create a new word document from a memory resident mail merge.
Code:
Set WordApp = CreateObject("Word.Application")
'Open document
WordApp.Documents.Open sFile
WordApp.Visible = False
'issue mailmerge command
With WordApp.ActiveDocument.MailMerge
.MainDocumentType = wdFormLetters
.OpenDataSource Name:=cDrive & "\AccessDataSource.xls", _
readonly:=True, Connection:=sTable, SubType:=wdMergeSubTypeWord, _
SQLStatement:="Select * From [" & sTable & "]"
.Destination = wdSendToNewDocument
.Execute
End With
' Save mailmerge
WordApp.ActiveDocument.SaveAs FileName:=sWord, FileFormat:=wdWordDocument, ReadOnlyRecommended:=True
The last line that tries to save the document fails once 'delete' permissions have been removed from the user.
How do I get round this?
Can I set the account to use when trying to save the document?
Thanks,
1DMF
"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Dance Music Downloads