Results 1 to 9 of 9

Userform related Excel application crash

Threaded View

  1. #1
    Registered User
    Join Date
    04-25-2011
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2007
    Posts
    19

    Userform related Excel application crash

    I can't seem to figure out what is causing Excel to freak out over the sequence below:

    Subroutine initializes the userform:
    Sub CreatePOUserForm()
    uf_1_CreatePO.Show
    End Sub
    Userform code:
    Private Sub UserForm_Initialize()
    
    Dim ws As Worksheet
    Dim iRow As Long
    Dim rngSuppliers As Range
    Dim Cell As Range
    Dim UniqueSupp As Collection
    Dim Supp As Variant
    
        iRow = 2
        Set ws = ThisWorkbook.Sheets("Suppliers")
        Set rngSuppliers = ws.Range("A" & iRow, ws.Range("A" & iRow).End(xlDown))
        Set UniqueSupp = New Collection
    
        On Error Resume Next
            For Each Cell In rngSuppliers.Cells
                UniqueSupp.Add Cell.Value, CStr(Cell.Value)
            Next Cell
        On Error GoTo 0
    
        For Each Supp In UniqueSupp
            Controls.Item("ComboBox1").AddItem Supp
        Next Supp
    End Sub
    User selection is passed through to MakeOrderTbl(Supp as String) subroutine:
    Private Sub CommandButton1_Click()
    
    Dim Supp As String
    
    Supp = Me.Controls.Item("ComboBox1").Value
    Unload Me
    Call MakeOrderTbl(Supp)
    
    End Sub
    I have "Stop" lines throughout the MakeOrderTbl(Supp as String) sub because I'm still tinkering with it. After stepping through a few stops, if I reset/end the procedure in the middle of MakeOrderTbl and then try to save the file, Excel crashes. I'm assuming the problem has to do with the way I'm initializing the userform, because if I run the Private Sub Userform_Initialize routine straight from the VBE, it doesn't cause a crash.

    Any ideas how to fix this? I've been searching the internet for the last two days and have tried a code cleaner and have also tried AdLoki's suggestion found here: http://www.excelforum.com/excel-prog...een-saved.html

    I also tried initializing the userform with:
    Sub Maint_btn_CreatePO_Click()
        uf_1_CreatePO.Show
    End Sub
    Sheetname "Maint" and button name "btn_CreatePO". I later saw this referenced without the sheetname+underscore prefix and have tried that as well.

    Thanks for your thoughts.
    Last edited by acellis9; 04-02-2014 at 03:08 PM. Reason: clarify pass-through variable in MakeOrderTbl sub name

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Formula related Crash on Opening File
    By Nodak in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 07:05 AM
  2. [SOLVED] Formula related Crash on Opening File
    By Nodak in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  3. Failed userform loading and cause application crash
    By noiseash in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-25-2005, 11:05 AM
  4. Fixing a Macro-related Crash in Excel
    By Danimagus in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-06-2005, 02:05 PM
  5. Application.Quit en Excel crash
    By Jos Vens in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-08-2005, 09:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1