PDA

View Full Version : Solved: How to make a folder in the same path



YasserKhalil
05-12-2010, 03:44 AM
Hi everybody
this is my first post in your excellent forum
I want to make a folder in this same path of my excel file
Excel Lover

GTO
05-12-2010, 03:55 AM
Hi there,

Is Yasser your first name?

Welcome to vbaexpress:hi:

Try:

Option Explicit

Sub exa()

On Error Resume Next
MkDir ThisWorkbook.Path & Application.PathSeparator & "MyNewDirectory"
On Error GoTo 0
End Sub

Hope that helps,

Mark

Edit: PS - You can use "\" in place of Application.PathSeperator; I just used that in case your system uses a different seperator.

YasserKhalil
05-12-2010, 04:12 AM
Thank you very much
I really like the code
U R Excellent

Yasser is my first name. I'm Egyptian my dear

Excel Lover

GTO
05-12-2010, 04:23 AM
Greetings Yasser,

You are most welcome of course. I am sure you will like it here, as there's a lot of nice folks who will go out of their way to help.

If you consider the problem solved, click on 'Thread Tools' right above your first post. There is an option to mark as Solved.

Have a great day :-)

Mark

YasserKhalil
05-12-2010, 05:22 AM
I didn't find the option "Solved"
please, explain it in detail

GTO
05-12-2010, 05:30 AM
After opening the thread, look atop your first post for the Thread Tools button, over near the right side.