Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2005
    Posts
    333

    Unanswered: Sharing a Folder

    I'm pretty sure that I'm going to have to use wscript for this but i can't find anything to support my theory. I want to be able to set the share properties of a folder using VBA. I.e. given a folderpath/name, I want to be able to share the folder, provide a share name for that folder and set share permissions. Any ideas how I can do this?

  2. #2
    Join Date
    Feb 2005
    Posts
    333
    For anyone interested. This works to create a shared folder

    Code:
    Const FILE_SHARE = 0
    Const MAXIMUM_CONNECTIONS = 25
    strComputer = "myComputerName"
    Set objWMIService = GetObject("winmgmts:" _
     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set objNewShare = objWMIService.Get("Win32_Share")
    errReturn = objNewShare.Create _
     ("C:\loads", "loads", FILE_SHARE, _
     MAXIMUM_CONNECTIONS, "Public share for the Loads directory.")

Posting Permissions

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