+ Reply to Thread
Results 1 to 4 of 4

VBA Variable as userform

  1. #1

    VBA Variable as userform

    I need some help:



    I am trying to declare a varible of type userform so I can pass it as a
    paramater such as :



    Public ufrmForm As UserForm



    Sub ValidEntry(i)
    For Each ctlFormControl In frmNewOrder.Controls
    If ctlFormControl.TabIndex = i Then
    Worksheets("WorkingArea").Activate
    Range("C2") = ctlFormControl
    Range("E2").Select
    If ActiveCell.Value = "not valid" Then
    intError = MsgBox(strMsg, vbOKOnly, "Error")
    Call TextSelect(frmNewOrder, i)
    End If
    Exit For
    End If
    Next ctlFormControl
    End Sub



    Public Sub TextSelect(ufrmForm, i)
    For Each ctlFormControl In ufrmForm.Controls
    If ctlFormControl.TabIndex = i Then
    ctlFormControl.SelStart = 0
    intTextLength = Len(ctlFormControl.Text)
    ctlFormControl.SelLength = intTextLength
    Exit For
    End If
    Next ctlFormControl
    End Sub



    not working real well...............any ideas?



    thanks and have a great day,

    Brian


  2. #2
    Bob Phillips
    Guest

    Re: VBA Variable as userform

    What is it supposed to do, and what does it do (not do)?

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    <[email protected]> wrote in message
    news:[email protected]...
    > I need some help:
    >
    >
    >
    > I am trying to declare a varible of type userform so I can pass it as a
    > paramater such as :
    >
    >
    >
    > Public ufrmForm As UserForm
    >
    >
    >
    > Sub ValidEntry(i)
    > For Each ctlFormControl In frmNewOrder.Controls
    > If ctlFormControl.TabIndex = i Then
    > Worksheets("WorkingArea").Activate
    > Range("C2") = ctlFormControl
    > Range("E2").Select
    > If ActiveCell.Value = "not valid" Then
    > intError = MsgBox(strMsg, vbOKOnly, "Error")
    > Call TextSelect(frmNewOrder, i)
    > End If
    > Exit For
    > End If
    > Next ctlFormControl
    > End Sub
    >
    >
    >
    > Public Sub TextSelect(ufrmForm, i)
    > For Each ctlFormControl In ufrmForm.Controls
    > If ctlFormControl.TabIndex = i Then
    > ctlFormControl.SelStart = 0
    > intTextLength = Len(ctlFormControl.Text)
    > ctlFormControl.SelLength = intTextLength
    > Exit For
    > End If
    > Next ctlFormControl
    > End Sub
    >
    >
    >
    > not working real well...............any ideas?
    >
    >
    >
    > thanks and have a great day,
    >
    > Brian
    >




  3. #3

    Re: VBA Variable as userform

    I call TextSelect and send 2 parameters:

    ufrmForm and i
    i is the tabindex of the control within the form ufrmForm.............

    in this call, the form is frmNeworder

    ufrmForm = frmNewOrder
    call NewOrder.TextSelect(ufrmForm, 1)

    Public sub TextSelect(ufrmForm, 1)

    TextSelect finds the control on the secified form and selects the text
    within that control for overtype

    regards,
    Brian


  4. #4

    Re: VBA Variable as userform

    CASE CLOSED.......................CASE SOLVED

    I found that the userform varible is not causing a problem.

    Brian


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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