Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MakeCompileFile question

Status
Not open for further replies.

RobSchultz

Programmer
Jun 1, 2000
444
US
Hello all,

I'm trying to create an add-in that does the following...

1. Stops IIS web services
2. Recompiles the project
3. Restarts IIS web services

This is all in the hope of making my life easier while testing Web COM objects. My problem is that the MakeCompileFile method always returns the error 80004005. There is almost no information about MakeCompileFile to be found anywhere. It looks like I'm using the method correctly but it just doesn't work. The code is below. Form is 2 buttons (btnExit, btnRecompile) and 2 labels (lblProject, lblStatus). I could use the command line /make but it requires that the project not be open. I'm not fixated on using any one method so any other ideas/help will be greatly appreciated...
Code:
Public VBInstance As VBIDE.VBE
Public Connect As Connect

Option Explicit

Private Sub btnExit_Click()
    Connect.Hide
End Sub

Private Sub Form_Load()
  lblProject = "Current Project: " & VBInstance.ActiveVBProject.Name
End Sub

Private Sub btnRecompile_Click()
  On Error GoTo errHandler
  Dim retVal As Variant
  Dim oWSH As Object
  Set oWSH = CreateObject("WScript.Shell")
  
  Status ("Stopping web services...")
    retVal = oWSH.Run("c:\winnt\system32\cmd.exe /c net stop ""IIS Admin Service"" /y", 7, True)
  Status ("Web services stopped.")
  
  Status ("Compiling project...")
    VBInstance.ActiveVBProject.MakeCompiledFile
  Status ("Project compiled.")
    
  Status ("Starting web services...")
    retVal = oWSH.Run("c:\winnt\system32\cmd.exe /c net start ""IIS Admin Service""", 7, True)
    retVal = oWSH.Run("c:\winnt\system32\cmd.exe /c net start ""World Wide Web Publishing Service""", 7, True)
  Status ("Web services started.")
  
  Status ("Finished!")
  Exit Sub
  
errHandler:
  MsgBox "Error Desc: " & Err.Description & vbCrLf & _
    "Error Number: " & Err.Number & vbCrLf & _
    "Error DLL: " & Err.LastDllError, , "ERROR!"
  Connect.Hide
  Unload Me
End Sub

Sub Status(msg As String)

  lblStatus = "Current Operation: " & msg

End Sub
Thanks, Rob
robschultz@yahoo.com
-Focus on the solution to the problem, not the obstacles in the way.-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top