How do I change a mouse pointer to an hourglass in excel OR disable the CLOSE PROGRAM (the "X" on the upper right hand)?
Thanks
Printable View
How do I change a mouse pointer to an hourglass in excel OR disable the CLOSE PROGRAM (the "X" on the upper right hand)?
Thanks
here you go..
VB Code:
Application.Cursor = xlWait 'your code here Application.Cursor = xlDefault
You can set it to:
xlDefault -The default pointer
xlWait - The hourglass pointer
xlNorthwestArrow - The northwest-arrow pointer
xlIBeam - The I-beam pointer
Thanks. Now I just how to figure out how to call this in my VB program when the function export to excel is called.
assuming you have a variable to reference excel:
objExcel.Cursor = xlWait
(where objExcel is your variable)
VB Code:
Dim objEXCEL As Object '-OBJECT USED TO EXPORT EXCEL Dim iINDEX As Integer Dim iROWINDEX As Integer Dim iCOLINDEX As Integer Dim iRECORDCOUNT As Integer Dim iFIELDCOUNT As Integer Dim sMESSAGE As String Dim avROWS As Variant Dim excelVERSION As Integer adoRSQUERY.MoveFirst '-PLACE ALL RECORDSET IN AN ARRAY avROWS = adoRSQUERY.GetRows() iRECORDCOUNT = UBound(avROWS, 2) + 1 iFIELDCOUNT = UBound(avROWS, 1) + 1 Set objEXCEL = CreateObject("Excel.Application") objEXCEL.Visible = True objEXCEL.workbooks.Add excelVERSION = Val(objEXCEL.Application.Version) If (excelVERSION >= 8) Then Set objEXCEL = objEXCEL.activesheet End If objEXCEL.cursor = xlwait
I get a "VARIABLE NOT DEFINED" error at the last line with the xlwait highlighted. What did I miss here?
VB Code:
Set objEXCEL = CreateObject("Excel.Application") 'MOVED HERE objEXCEL.cursor = xlwait objEXCEL.Visible = True objEXCEL.workbooks.Add excelVERSION = Val(objEXCEL.Application.Version) If (excelVERSION >= 8) Then Set objEXCEL = objEXCEL.activesheet End If
I moved the line but I still get the same error.
ah, didn't realise you were using late binding...
the value of xlWait is 2, so just put 2 in place of it ;)
to find out any other Excel constants (xl***), go into Excel's Vba editor and press F2 - type the name into the second combo, press the find icon, then you will get the definition at the bottom of the screen (eg: Const xlWait = 2)
Great that did the trick!!! Thank you.