1.用系统存储过程,忘了哪一个了^_^
2.Public Function NewWebSite(ByVal Comment As String, ByVal RootPath As String, ByVal IPAddress As String, _
ByVal HostName As String, ByVal PortNo As String, ByVal SiteIndex As Integer) As Boolean Dim objADSI As Object
Dim objWebSite As Object
Dim objVDir As Object
On Error GoTo Lib_Err
Set objADSI = GetObject("IIS://" & HostName & "/W3SVC")
On Error GoTo Lib_Err
Set objWebSite = objADSI.Create("IIsWebServer", SiteIndex)
objWebSite.ServerComment = Comment
objWebSite.ServerBindings = PortNo
objWebSite.Setinfo
Set objVDir = objWebSite.Create("IIsWebVirtualDir", "ROOT")
objVDir.Path = RootPath
objVDir.AccessRead = True
objVDir.EnableDirBrowsing = True
objVDir.Setinfo
objWebSite.Start
NewWebSite = TrueLib_End: Set objVDir = Nothing
Set objWebSite = Nothing
Set objADSI = Nothing
Exit FunctionLib_Err: NewWebSite = False
VBA.MsgBox Err.Description
Err.Clear
Resume Lib_End
End Function
2.Public Function NewWebSite(ByVal Comment As String, ByVal RootPath As String, ByVal IPAddress As String, _
ByVal HostName As String, ByVal PortNo As String, ByVal SiteIndex As Integer) As Boolean Dim objADSI As Object
Dim objWebSite As Object
Dim objVDir As Object
On Error GoTo Lib_Err
Set objADSI = GetObject("IIS://" & HostName & "/W3SVC")
On Error GoTo Lib_Err
Set objWebSite = objADSI.Create("IIsWebServer", SiteIndex)
objWebSite.ServerComment = Comment
objWebSite.ServerBindings = PortNo
objWebSite.Setinfo
Set objVDir = objWebSite.Create("IIsWebVirtualDir", "ROOT")
objVDir.Path = RootPath
objVDir.AccessRead = True
objVDir.EnableDirBrowsing = True
objVDir.Setinfo
objWebSite.Start
NewWebSite = TrueLib_End: Set objVDir = Nothing
Set objWebSite = Nothing
Set objADSI = Nothing
Exit FunctionLib_Err: NewWebSite = False
VBA.MsgBox Err.Description
Err.Clear
Resume Lib_End
End Function
能给个例程吗?