Results 1 to 6 of 6

Make Folder on Desktop

Threaded View

realniceguy5000 Make Folder on Desktop 05-15-2009, 04:08 PM
shg Re: Make Folder on Desktop 05-15-2009, 04:16 PM
shg Re: Make Folder on Desktop 05-15-2009, 04:20 PM
realniceguy5000 Re: Make Folder on Desktop 05-15-2009, 04:28 PM
Kenneth Hobson Re: Make Folder on Desktop 05-15-2009, 11:15 PM
realniceguy5000 Re: Make Folder on Desktop 05-18-2009, 08:07 AM
  1. #1
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Make Folder on Desktop

    Hi,

    I'm trying to create a folder on the desktop and save the activeworkbook in that folder. Since other users will use this I dont know the exact path. However I'm using this function below to tell the script where to find the path. Everything was working fine till I started to make the folder can someone point out what I may be doing wrong?

    Thank You, Mike

    Sub MoveMe()
    
    Dim name As String
    Dim d As String
    
    name = ActiveWorkbook.name
    d = "Production 2009"
    MkDir SpecialFolderPath / d
    
    
    ChDir SpecialFolderPath
    ActiveWorkbook.SaveAs Filename:=speacialfolderpath & d & name
    End Sub
    
    Function SpecialFolderPath() As String
         
        Dim objWSHShell As Object
        Dim strSpecialFolderPath
         
         'On  Error GoTo ErrorHandler
         ' Create a shell object
        Set objWSHShell = CreateObject("WScript.Shell")
         '  Find out the path to the passed special folder,
         '  just change the "Desktop" for one of the other options
        SpecialFolderPath = objWSHShell.SpecialFolders("Desktop")
         ' Clean up
        Set objWSHShell = Nothing
        Exit Function
    ErrorHandler:
         
         MsgBox "Error finding " & strSpecialFolder, vbCritical + vbOKOnly, "Error"
    End Function
    Last edited by realniceguy5000; 05-18-2009 at 08:07 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1