tags:

views:

75

answers:

2

Hi ,

I use the below code to assign rights to the folder this works fine when i create a folder on say "C:/Test" and run the code it works fine without any issues but once i try the same with the folder "C:/Documents and Settings" i get an error .

Here is the code its a VBA code done on a word document.

Dim intRunError, objShell, objFSO,strHomeFolder
strHomeFolder = "C:/Documents and Settings"

    Set objShell = CreateObject("Wscript.Shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")

    If objFSO.FolderExists(strHomeFolder) Then
    intRunError = objShell.Run("%COMSPEC% /c Echo Y| cacls " _
    & strHomeFolder & " /e /c /g everyone:F ", 2, True)
    End If
    MsgBox intRunError
+1  A: 

Perhaps:

"%COMSPEC% /c Echo Y| cacls """ & strHomeFolder & """ /e /c /g everyone:F "
Remou
Hi, How do i create a user account ?I mean i want to create a ASPNET user account programmatically ?Thanks
francisf
If this has answered your question, you should accept this, then ask a new question
Christian Payne
A: 

Hi Remou ,

Thanks for your reply i tried and it works.

I have another problem regarding the VBA code in my word document.

I am using a web application to download the word document this word document is added with a MAcro code using the interop which implements the autosave behaviour to the server.

Now i select the link to download the word file and its ask for a whether to open ,save or cancel option basically asking the user.

I then select the open command and the file is opened in the temporary internet files folder somewhere ,i then do changes to the document and click on the word close button this is where the macro is written on close the changes done need to be saved on to the server . It works fine if i use the "Save" option and then make changes and close it gets updated to the server.

the error i get is "Error Runtime error 5487 word cannot complete the save due to file premission error."

Kindly suggest what am i doing wrong here.

Thanks Francis .

francisf
this should be asked as another question, not added as an answer.
Jeff Atwood