Results 1 to 1 of 1
  1. #1
    Join Date
    Oct 2003
    Posts
    6

    Red face Unanswered: Runtime Error 462

    My code runs fine once but when i try to rerun the form i get runtime error 462. If any one can help Here is my code:

    Private Sub cmbShifts_AfterUpdate()
    '************************************************* ****************************
    Dim appExcel As Excel.Application
    Dim myWorkbook As Excel.Workbook

    Set appExcel = CreateObject(New Excel.Application)
    Set myWorkbook = appExcel.Workbooks.Open("C:\wsr\wsr.xls")

    appExcel.Visible = False
    Set appExcel = Nothing
    Set myWorkbook = Nothing

    Worksheets("DMR").Select
    '************************************************* ****************************
    'WED -1 AM

    If Me.cmbShifts = "WED -1" Then
    Me.drName1 = Excel.Range("b10")
    Me.totalSales1 = Excel.Range("b11")
    Me.netSales1 = Excel.Range("b12")
    Me.creditCards1 = Excel.Range("b15")
    Me.cashDue1 = Excel.Range("b16")
    Me.dmr1 = Excel.Range("b13")

    Me.drName2 = Excel.Range("c10")
    Me.totalSales2 = Excel.Range("c11")
    Me.netSales2 = Excel.Range("c12")
    Me.creditCards2 = Excel.Range("c15")
    Me.cashDue2 = Excel.Range("c16")
    Me.dmr2 = Excel.Range("c13")

    Me.drName3 = Excel.Range("d10")
    Me.totalSales3 = Excel.Range("d11")
    Me.netSales3 = Excel.Range("d12")
    Me.creditCards3 = Excel.Range("d15")
    Me.cashDue3 = Excel.Range("d16")
    Me.dmr3 = Excel.Range("d13")
    End If

    'WED -2 PM

    If Me.cmbShifts = "WED -2" Then
    Me.drName1 = Excel.Range("s10")
    Me.totalSales1 = Excel.Range("s11")
    Me.netSales1 = Excel.Range("s12")
    Me.creditCards1 = Excel.Range("s15")
    Me.cashDue1 = Excel.Range("s16")
    Me.dmr1 = Excel.Range("s13")

    Me.drName2 = Excel.Range("t10")
    Me.totalSales2 = Excel.Range("t11")
    Me.netSales2 = Excel.Range("t12")
    Me.creditCards2 = Excel.Range("t15")
    Me.cashDue2 = Excel.Range("t16")
    Me.dmr2 = Excel.Range("t13")

    Me.drName3 = Excel.Range("u10")
    Me.totalSales3 = Excel.Range("u11")
    Me.netSales3 = Excel.Range("u12")
    Me.creditCards3 = Excel.Range("u15")
    Me.cashDue3 = Excel.Range("u16")
    Me.dmr3 = Excel.Range("u13")
    End If
    Shell ("Taskkill /f /im excel.exe")
    End Sub
    Last edited by aboboo; 12-10-09 at 11:08.

Posting Permissions

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