ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create a folder from excel (https://www.excelbanter.com/excel-programming/340689-create-folder-excel.html)

Tempy

Create a folder from excel
 
Hi all, i know it is possible to creat a shortcut on the desktop from
excel and would like to know if it is possible to create a folder from
excel as well ?
If so, could you help me some code please.

thanks in advance,

Tempy

*** Sent via Developersdex http://www.developersdex.com ***

Bob Phillips[_6_]

Create a folder from excel
 
Make a folder

MkDir "C:\Mytest\mine"

you will need to create every level if they don't exsit.

Shortcut


'----------------------------------------------------------------
Sub CreateShortCut()
'----------------------------------------------------------------
Dim oWSH As Object
Dim oShortcut As Object
Dim sPathDeskTop As String

Set oWSH = CreateObject("WScript.Shell")
sPathDeskTop = oWSH.SpecialFolders("Desktop")

Set oShortcut = oWSH.CreateShortCut(sPathDeskTop & "\" & _
ActiveWorkbook.Name & ".lnk")
With oShortcut
.TargetPath = ActiveWorkbook.FullName
.Save
End With
Set oWSH = Nothing

End Sub



--
HTH

Bob Phillips

"Tempy" wrote in message
...
Hi all, i know it is possible to creat a shortcut on the desktop from
excel and would like to know if it is possible to create a folder from
excel as well ?
If so, could you help me some code please.

thanks in advance,

Tempy

*** Sent via Developersdex http://www.developersdex.com ***




NickHK

Create a folder from excel
 
Tempy,
MkDir

NickHK

"Tempy" wrote in message
...
Hi all, i know it is possible to creat a shortcut on the desktop from
excel and would like to know if it is possible to create a folder from
excel as well ?
If so, could you help me some code please.

thanks in advance,

Tempy

*** Sent via Developersdex http://www.developersdex.com ***




Tempy

Create a folder from excel
 
Thanks so much Bob, how's the weather there ?

Tempy

*** Sent via Developersdex http://www.developersdex.com ***

Bob Phillips[_6_]

Create a folder from excel
 
Not too bad, autumn coming in now though.

--
HTH

Bob Phillips

"Tempy" wrote in message
...
Thanks so much Bob, how's the weather there ?

Tempy

*** Sent via Developersdex http://www.developersdex.com ***




Tempy

Create a folder from excel
 
Hi Bob, sorry for the delay, here it is really nice hot sunny days,
today 32 !!
Bob, is it possible to assign a specific icon to the shortcut that you
create ?

Tempy

*** Sent via Developersdex http://www.developersdex.com ***

Bob Phillips[_6_]

Create a folder from excel
 
Yeah, just use the .IconLocation property when creating the shortcut.

--
HTH

Bob Phillips

"Tempy" wrote in message
...
Hi Bob, sorry for the delay, here it is really nice hot sunny days,
today 32 !!
Bob, is it possible to assign a specific icon to the shortcut that you
create ?

Tempy

*** Sent via Developersdex http://www.developersdex.com ***




Tempy

Create a folder from excel
 
Hi Bob, thanks. I am not sure where to put it. Let me explain what i am
wanting to do.... should of done that before i guess. I want to send all
the users an excel file with the code in and when they open it, it will
create the folders and save the file in there. I then create a short cut
and then want to assign a different icon to it. I am not sure how to do
that portion, should i insert the icon on the spread sheet so that it
can save it also to the folder ?

Tempy

*** Sent via Developersdex http://www.developersdex.com ***


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

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