Creating Directories

  • Thread starter Thread starter wardides
  • Start date Start date
W

wardides

Hi,

I have 2 seerate Queries I am looking for solutions too.

1) Creat a new Directory

I want to create a directory if it dosent't exist.

MkDir allows me to create a directory but only 1 level above what i
there. i.e
if C:\Wages\ then I can create C:\Wages\Jan
but it will not let me create them if C:Wages is not there.
Is there a way to create more then 1 level in the code or do I have t
llop through it.

2) If I have a button on the screen, is there a way to get the cel
reference that it is on. I have about 10 buttons on the screen an
dependant on which one is selected I want to select a certain range o
cells.
Is it possible to know what cell is below a button or link a button t
the cell ?

Thanks
Bria
 
For buttons from the forms toolbar

set cell = Activesheet.Buttons(1).TopLeftCell

for commandbuttons from the control toolbox toolbar

set cell = ActiveSheet.OleObjects("CommandButton1").TopLeftCell


On Error Resume Next
mkdir "C:\MyDir2"
mkdir "C:\MyDir2\MySubDir1"
mkdir "C:\MyDir2\MySubDir1\MySubSubDir1"
On Error goto 0
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top