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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable the Excel Window 'X' from VB App.

Status
Not open for further replies.

sam2601

Programmer
Apr 9, 2004
81
0
0
US
Hi guys,

I have a VB app in which we are creating a Excel spreadsheet and filling in data on fly.What is happening is
when it is still loading the user is trying to close the Excel spreadsheet and this is causing a error in VB app and closing the app.

Is there any way we can disable the 'X' close button excel window through VB

Any ideas surely appreciated .

Thanks
 
have not found a solution that take the x away, but why not keep the WindowState = xlMinimized and then maximize it when the data is loaded
 
SET TO VISIBLE = FALSE see code below they are my actual code

Public Function GetExcelApp() As Excel.Application

While bAppInUse
DoEvents
Wend

bAppInUse = True

If oExcelApp Is Nothing Then
Set oExcelApp = CreateObject("EXCEL.APPLICATION")
oExcelApp.Visible = False
oExcelApp.Workbooks.Open (oExcelApp.Application.LibraryPath & "\Analysis\atpvbaen.xla")
oExcelApp.Workbooks("atpvbaen.xla").RunAutoMacros (xlAutoOpen)
End If

Set GetExcelApp = oExcelApp

End Function
 
Thanks tdong

Actually now i am controlling the VB app from breaking by trapping the Err code.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top