Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default How to create a folder & error handler

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default How to create a folder & error handler

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" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default How to create a folder & error handler

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" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error Handler displaying message when no error Code Numpty Excel Programming 5 September 28th 09 07:25 PM
Error Handler sharad Excel Discussion (Misc queries) 1 September 17th 07 06:38 PM
Save file in a new folder, but create folder only if folder doesn't already exist? nbaj2k[_40_] Excel Programming 6 August 11th 06 08:41 PM
Form Err.Raise error not trapped by entry procedure error handler [email protected] Excel Programming 1 February 8th 06 10:19 AM
Error handler help Nigel Excel Programming 2 May 5th 05 11:08 AM


All times are GMT +1. The time now is 11:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"