Thread: Delete Module
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bre-x[_2_] Bre-x[_2_] is offline
external usenet poster
 
Posts: 8
Default Delete Module

Thank you. It works very well!!!


"Peter T" <peter_t@discussions wrote in message
...
add -
Dim objWB as Object

change -
.Workbooks.Open thepath

to
set objWB = .Workbooks.Open(thepath)

and change -
With ThisWorkbook.VBProject.VBComponents

to
With objWB .VBProject.VBComponents

Regards,
Peter T



"Bre-x" wrote in message
...
Thank you for you answer.

It doesnt work. Sorry, I dont understand your instructions.


Public Function lathe_V11(tcid As Double, tlid As Double, custid As
String, mach As Integer, prog As Integer)
'Dim string Variables
Dim thepath As String

'Dim Excel Object
Dim objXL As Object
Set objXL = CreateObject("Excel.Application")
thepath = mypath & mach & "\" & custid & "\" & mach & prog & ".xls"


With objXL.Application
.Visible = True
.Workbooks.Open thepath
.ActiveWindow.WindowState = xlMinimized
With ThisWorkbook.VBProject.VBComponents
.Remove .Item("Module1")
End With

End With
End Function