Senin, 19 Maret 2012

[ExcelVBA] Re: Error in User form

 

What about this:

Private Sub UserForm_Click()

UserForm.Show

End Sub

Is there a specific purpose for it?

I never tried show-ing a UserForm by clicking it, I always just assumed that if it WASN'T showing, you couldn't click it. Unless, however, the code has been changed for this post.

The only scenario I've used it in is to Show another form that is already loaded into memory. If that's not the problem, I don't know what else it would be!

--- In ExcelVBA@yahoogroups.com, JIM NEELY <jimneely@...> wrote:
>
> Maybe this will help. Here is my whole code for the Userform. Hope this will give you an idea as to why i can click out side any box and get an error.
>
>
>
> Private Sub CancelCommandButton_Click()
> Sheets(1).Activate
> Unload Me
> End Sub
> Private Sub ClearCommandButton_Click()
> Call UserForm_Initialize
> End Sub
> Private Sub OkayCommandButton_Click()
> Dim emptyRow As Long
> 'Make Sheet1 Active
> Application.ScreenUpdating = False
> Sheets(2).Activate
> 'Determine emptyRow
> emptyRow = WorksheetFunction.CountA(Range("B:B")) + 1
>
> 'Export Data to worksheet
> Cells(emptyRow, 1).Value = Now()
> Cells(emptyRow, 2).Value = DeptListBox.Value
> Cells(emptyRow, 3).Value = LineListBox.Value
> Cells(emptyRow, 4).Value = MachineListBox.Value
> Cells(emptyRow, 5).Value = PartNTextBox.Value
> Cells(emptyRow, 6).Value = OldSNTextBox.Value
> Cells(emptyRow, 7).Value = NewSNTextBox.Value
> Cells(emptyRow, 8).Value = ProblemTextBox.Value
> Cells(emptyRow, 9).Value = SolutionTextBox.Value
> Cells(emptyRow, 10).Value = CauseListBox.Value
> Cells(emptyRow, 11).Value = ActionListBox.Value
> Call UserForm_Initialize
> End Sub
> Private Sub UserForm_Click()
> UserForm.Show
> End Sub
> Private Sub UserForm_Initialize()
> DeptListBox.Clear
> With DeptListBox
>     .AddItem "M200"
>     .AddItem "B800"
>     .AddItem "B700"
>     .AddItem "423K"
>     .AddItem "143K"
>     .AddItem "481K"
>     .AddItem "Tool Room"
>     .AddItem "Maintenance"
>     .AddItem "Investigation"
> End With
> LineListBox.Clear
> With LineListBox
>     .AddItem "Oil Pump"
>     .AddItem "Drum"
>     .AddItem "Gear"
>     .AddItem "ASSY"
>     .AddItem "Case"
>     .AddItem "T/C"
>     .AddItem "V/B"
>     .AddItem "D"
>     .AddItem "Press"
>     .AddItem "Main Line"
>     .AddItem "Sub Line"
>     .AddItem "Brazing"
>     .AddItem "Heat Treat"
>     .AddItem "Kaizen"
> End With
> MachineListBox.Clear
> With MachineListBox
>     .AddItem "Machine"
>     .AddItem "Station"
> End With
> CauseListBox.Clear
> With CauseListBox
>     .AddItem "Wear"
>     .AddItem "Abuse"
>     .AddItem "Lost"
> End With
> ActionListBox.Clear
> With ActionListBox
>     .AddItem "Replace"
>     .AddItem "Repair"
> End With
> PartNTextBox.Value = ""
> OldSNTextBox = "N/A"
> NewSNTextBox = "N/A"
> SolutionTextBox = ""
> ProblemTextBox = ""
> 'Set Focus on DeptTextBox
> DeptListBox.SetFocus
> End Sub
>
>
> [Non-text portions of this message have been removed]
>

__._,_.___
Recent Activity:
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------
.

__,_._,___

Tidak ada komentar:

Posting Komentar