PC Review


Reply
Thread Tools Rate Thread

How to create a folder & error handler

 
 
Mel
Guest
Posts: n/a
 
      26th Feb 2010
Excel 2003 & 2007

Hi. Can someone please help me with a code snippit that creates "Test"
folder in the users C:\ root directory; creates "test.txt" file and
"test.ppt" file within that new folder; and also creates "SubTest"
folder in that new folder, but then if they don't have permissions to
create such items it displays an alert "Code P21 - See admin" and then
exits the routine?

Thanks,
Melina

 
Reply With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      27th Feb 2010
To create the folder:

Sub dk()
ChDir "C:\"
MkDir "test"
End Sub

Then save your files as "C:\test\test.ppt" and "C:\test\test.txt".



"Mel" <(E-Mail Removed)> wrote in message
news:b0d5fbd1-3de2-4742-9127-(E-Mail Removed)...
> Excel 2003 & 2007
>
> Hi. Can someone please help me with a code snippit that creates "Test"
> folder in the users C:\ root directory; creates "test.txt" file and
> "test.ppt" file within that new folder; and also creates "SubTest"
> folder in that new folder, but then if they don't have permissions to
> create such items it displays an alert "Code P21 - See admin" and then
> exits the routine?
>
> Thanks,
> Melina
>



 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      27th Feb 2010
I didn't read the entire post, here is the rest:

Sub dk()
On Error GoTo HNDL:
ChDir "C:\"
MkDir "test"
HNDL:
If Err.Number > 0 Then
If Err.Number = 70 Then
MsgBox "Permission Denied"
Else
MsgBox Err.Number & " has occurred"
End If
End If
End Sub





"Mel" <(E-Mail Removed)> wrote in message
news:b0d5fbd1-3de2-4742-9127-(E-Mail Removed)...
> Excel 2003 & 2007
>
> Hi. Can someone please help me with a code snippit that creates "Test"
> folder in the users C:\ root directory; creates "test.txt" file and
> "test.ppt" file within that new folder; and also creates "SubTest"
> folder in that new folder, but then if they don't have permissions to
> create such items it displays an alert "Code P21 - See admin" and then
> exits the routine?
>
> Thanks,
> Melina
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create Dynamic Event Handler spam101449@hotmail.co.uk Microsoft VB .NET 4 8th Dec 2008 01:44 PM
how to create static event handler samuelberthelot@googlemail.com Microsoft ASP .NET 0 7th Mar 2006 09:58 AM
Failure to create event handler =?Utf-8?B?UmljaGFyZCBX?= Microsoft ASP .NET 12 26th Jul 2005 07:35 PM
Front Page XP error <Server error: cannot create folder _vti_cnf. =?Utf-8?B?R2VvcmdlMjAwMQ==?= Microsoft Frontpage 1 14th Oct 2004 03:51 PM
Create new event handler or override existing handler? =?Utf-8?B?V29vbiBLaWF0?= Microsoft Dot NET Framework Forms 1 5th Jan 2004 08:08 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:17 PM.