Results 1 to 8 of 8

Thread: Mouse Pointer to Hourglass

  1. #1

    Thread Starter
    Hyperactive Member ARPRINCE's Avatar
    Join Date
    Mar 2003
    Location
    Pinoy in NJ
    Posts
    381

    Question Mouse Pointer to Hourglass

    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

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    here you go..
    VB Code:
    1. Application.Cursor = xlWait
    2. 'your code here
    3.     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

  3. #3

    Thread Starter
    Hyperactive Member ARPRINCE's Avatar
    Join Date
    Mar 2003
    Location
    Pinoy in NJ
    Posts
    381
    Thanks. Now I just how to figure out how to call this in my VB program when the function export to excel is called.

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    assuming you have a variable to reference excel:

    objExcel.Cursor = xlWait

    (where objExcel is your variable)

  5. #5

    Thread Starter
    Hyperactive Member ARPRINCE's Avatar
    Join Date
    Mar 2003
    Location
    Pinoy in NJ
    Posts
    381
    VB Code:
    1. Dim objEXCEL As Object     '-OBJECT USED TO EXPORT EXCEL
    2.    Dim iINDEX As Integer
    3.    Dim iROWINDEX As Integer
    4.    Dim iCOLINDEX As Integer
    5.    Dim iRECORDCOUNT As Integer
    6.    Dim iFIELDCOUNT As Integer
    7.    Dim sMESSAGE As String
    8.    Dim avROWS As Variant
    9.    Dim excelVERSION As Integer
    10.    
    11.    adoRSQUERY.MoveFirst
    12.    '-PLACE ALL RECORDSET IN AN ARRAY
    13.    avROWS = adoRSQUERY.GetRows()
    14.    
    15.    iRECORDCOUNT = UBound(avROWS, 2) + 1
    16.    iFIELDCOUNT = UBound(avROWS, 1) + 1
    17.    
    18.    Set objEXCEL = CreateObject("Excel.Application")
    19.    objEXCEL.Visible = True
    20.    objEXCEL.workbooks.Add
    21.    
    22.    excelVERSION = Val(objEXCEL.Application.Version)
    23.    If (excelVERSION >= 8) Then
    24.       Set objEXCEL = objEXCEL.activesheet
    25.    End If
    26.    objEXCEL.cursor = xlwait

    I get a "VARIABLE NOT DEFINED" error at the last line with the xlwait highlighted. What did I miss here?

  6. #6

    Thread Starter
    Hyperactive Member ARPRINCE's Avatar
    Join Date
    Mar 2003
    Location
    Pinoy in NJ
    Posts
    381
    VB Code:
    1. Set objEXCEL = CreateObject("Excel.Application")
    2.    'MOVED HERE
    3.    objEXCEL.cursor = xlwait
    4.    objEXCEL.Visible = True
    5.    objEXCEL.workbooks.Add
    6.      
    7.    excelVERSION = Val(objEXCEL.Application.Version)
    8.    If (excelVERSION >= 8) Then
    9.       Set objEXCEL = objEXCEL.activesheet
    10.    End If

    I moved the line but I still get the same error.

  7. #7
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    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)

  8. #8

    Thread Starter
    Hyperactive Member ARPRINCE's Avatar
    Join Date
    Mar 2003
    Location
    Pinoy in NJ
    Posts
    381

    Thumbs up

    Great that did the trick!!! Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width