|
-
May 7th, 2006, 03:28 AM
#1
Thread Starter
Junior Member
[RESOLVED] Making a new folder
Hello everyone,
I am having a silly problem but it is driving me crazy.
When i try to make a new directory using mkdir or filesystemObject in VB 6 it always makes it with "read-only" attribute and then if i try to write or overwrite something in it, it tells me "Access denied". I tried to change the attribute before writing or overwriting to it using the following code:
Function CreateFolder(sFolderName As String)
Dim objFSO As Scripting.FileSystemObject
Dim objFolder As Scripting.Folder
Dim strFolderPath As String
Dim attr As Scripting.FileAttribute
Set objFSO = New Scripting.FileSystemObject
Set objFolder = objFSO.CreateFolder(sFolderName)
objFolder.Attributes = Normal
End Function
It does not work, if i try to change the attribute to something other than 'Normal' it would work fine. It doesn't like 'Normal' though.
Help Please
thanks all
-
May 7th, 2006, 04:31 AM
#2
Fanatic Member
Re: Making a new folder
What is the reference that u have taken to do it?
Dont rely only on your luck. Work hard until You get success.
vb Code:
Private sub Time_ispassing
While Me.Notgetsuccess
trygain=tryagain+1
Me.workhard
wend
end sub
-
May 7th, 2006, 04:52 AM
#3
Thread Starter
Junior Member
Re: Making a new folder
Hey look, someone finally replied. I thought this problem is simple.
anyway, to start off, i am not sure what you are asking? but if you are asking about the additional references ,i have "microsoft scripting runtime, and Windows Script Host Object Model" and in the code I am passing the directory name. A thought that cross my mind is that, I am doing this code for my work and I beleive that because the program is actually making the directory and now me "the power user" then it creates it as a read only.
I don't know what to make out of that but..
thanks again
-
May 7th, 2006, 05:12 AM
#4
Fanatic Member
Re: Making a new folder
Hey its strange problem!!! As u said that it is working with another attribute mine is aslo working with archive but when it is normal it is not happening. Don't know why????????
Dont rely only on your luck. Work hard until You get success.
vb Code:
Private sub Time_ispassing
While Me.Notgetsuccess
trygain=tryagain+1
Me.workhard
wend
end sub
-
May 7th, 2006, 05:20 AM
#5
Fanatic Member
Re: Making a new folder
Hey!!!! Check it out. This may help you!
Dont rely only on your luck. Work hard until You get success.
vb Code:
Private sub Time_ispassing
While Me.Notgetsuccess
trygain=tryagain+1
Me.workhard
wend
end sub
-
May 7th, 2006, 05:29 AM
#6
Re: Making a new folder
Where are you creating the folder? If you are on a restricted (non admin) account I believe it has to be within your personal documents area.
-
May 7th, 2006, 05:50 AM
#7
Thread Starter
Junior Member
Re: Making a new folder
thanks guys for your help,
Vivek, i tried the code and it says that changing the attribute is not available. I think Penagate is right. it has to do with creating a directory in a restricted area. althought even when i have an admin previlege i got the same error. I think i need to specify the attribute before creating the directory. maybe that will work.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|