ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Creating Directories (https://www.excelbanter.com/excel-programming/312671-creating-directories.html)

wardides[_4_]

Creating Directories
 

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

--
wardide
-----------------------------------------------------------------------
wardides's Profile: http://www.excelforum.com/member.php...fo&userid=1502
View this thread: http://www.excelforum.com/showthread.php?threadid=26685


Tom Ogilvy

Creating Directories
 
For buttons from the forms toolbar

set cell = Activesheet.Buttons(1).TopLeftCell

for commandbuttons from the control toolbox toolbar

set cell = ActiveSheet.OleObjects("CommandButton1").TopLeftCe ll


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




--
Regards,
Tom Ogilvy

"wardides" wrote in message
...

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 is
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 to
llop through it.

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

Thanks
Brian


--
wardides
------------------------------------------------------------------------
wardides's Profile:

http://www.excelforum.com/member.php...o&userid=15022
View this thread: http://www.excelforum.com/showthread...hreadid=266858





All times are GMT +1. The time now is 05:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com