Create a folder from excel

T

Tempy

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 ***
 
B

Bob Phillips

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
 
T

Tempy

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 ***
 
T

Tempy

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 ***
 

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

Similar Threads

Need Help with Macro Security 1
Change desktop icon 3
Change color on faceid 3077 2
Merging from an Excel file with graphics 1
associative arrays 2
Excel icon 1
Hide tool bar 4
Personal.xls 8

Top