PDA

Click to See Complete Forum and Search --> : Mouse Pointer to Hourglass


ARPRINCE
Oct 10th, 2003, 08:43 AM
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

si_the_geek
Oct 10th, 2003, 09:19 AM
here you go..

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

ARPRINCE
Oct 10th, 2003, 09:40 AM
Thanks. Now I just how to figure out how to call this in my VB program when the function export to excel is called.

si_the_geek
Oct 10th, 2003, 09:42 AM
assuming you have a variable to reference excel:

objExcel.Cursor = xlWait

(where objExcel is your variable)

ARPRINCE
Oct 10th, 2003, 09:50 AM
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?

ARPRINCE
Oct 10th, 2003, 10:06 AM
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.

si_the_geek
Oct 10th, 2003, 11:24 AM
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)

ARPRINCE
Oct 10th, 2003, 11:29 AM
Great that did the trick!!! Thank you.