Create a folder from excel

  • Thread starter Thread starter Tempy
  • Start date Start date
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
 
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
 
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
 
Yeah, just use the .IconLocation property when creating the shortcut.
 
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
 

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

Change desktop icon 3
Get names from Access table 5
Excel icon 1
Hide tool bar 4
SAP / Excel 3
Disable an Autostart module 2
Create a shortcut to a folder with VBA 3
Browse dialoge 2

Back
Top