Author Topic: vba-problem  (Read 3317 times)

0 Members and 1 Guest are viewing this topic.

krampaul82

  • Guest
vba-problem
« on: October 23, 2008, 03:06:07 PM »
 :realmad:

To whom it may concern,
The following code does what it is suppost to for the first 2 case statements GT-116 PD and GT-116 PC but fails to work for the next two case statements GT-116 PB and GT-116 PA.
It will warn the user to pick a horizontal or vertical duct mount position (see code)
any help would be appreciated.

Mark

VBA code start
Code: [Select]

Private Sub cmd_sensor_gt_116_p_Click()

'ComboBox_gt_116_p Dropdown Menu
  ComboBox_gt_116_p.Style = fmStyleDropDownList

'Get ComboBox_gt_116_p Dropdown Menu user pick
 Select Case ComboBox_gt_116_p.Text
     
     Case "GT 116-PD"    'Calls sub from Module_ebtron_sensors
     
       If Opt1_gt_116_horiz = True Then
       'Gets the Horizontal block
        Sensor_gt_116_pd_horizontal_get
       End If
       If Opt2_gt_116_vert = True Then
       'Gets the Vertical block
        Sensor_gt_116_pd_vertical_get
       Else: pick_gt_116_position_warn
       End If
     
     Case "GT 116-PC"    'Calls sub from Module_ebtron_sensors
     
       If Opt1_gt_116_horiz = True Then
       'Gets the Horizontal block
        Sensor_gt_116_pc_horizontal_get
       End If
       
       If Opt2_gt_116_vert = True Then
       'Gets the Vertical block
         Sensor_gt_116_pc_vertical_get
        Else: pick_gt_116_position_warn
       End If
                 
     Case "GT 116-PB"    'Calls sub from Module_ebtron_sensors
         
         If Opt1_gt_116_horiz = True Then
         'Gets the Horizontal block
          Sensor_gt_116_pb_horizontal_get
         End If
         
         If Opt2_gt_116_vert = True Then
         'Gets the Vertical block
          Sensor_gt_116_pb_vertical_get
         Else: pick_gt_116_position_warn
         End If
     
     Case "GT 116-PA"    'Calls sub from Module_ebtron_sensors
     
        If Opt1_gt_116_horiz = True Then
        'Gets the Horizontal block
          Sensor_gt_116_pa_horizontal_get
        End If
       
        If Opt2_gt_116_vert = True Then
        'Gets the Vertical block
          Sensor_gt_116_pa_vertical_get
        Else: pick_gt_116_position_warn
        End If
       
      End Select
     
End Sub
« Last Edit: October 23, 2008, 03:53:02 PM by CmdrDuh »

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: vba-problem
« Reply #1 on: October 23, 2008, 03:18:08 PM »
Mayber there's something wrong with one of these subs?

Sensor_gt_116_pa_horizontal_get
Sensor_gt_116_pb_horizontal_get
Sensor_gt_116_pa_vertical_get
Sensor_gt_116_pb_vertical_get
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

krampaul82

  • Guest
Re: vba-problem
« Reply #2 on: October 23, 2008, 03:42:08 PM »
The modules that contain those subs are pretty much the same and will do what they are suppost to if run individually

Bob Wahr

  • Guest
Re: vba-problem
« Reply #3 on: October 23, 2008, 03:46:05 PM »
There is something going wrong somewhere (obviously) posting a small part of a larger whole doesn't really help a lot in seeing what's going on.  My sugestion would be to put a breakpoint in and step through the code with F8 so you can see what it (the code) is doing on a line by line basis.

krampaul82

  • Guest
Re: vba-problem
« Reply #4 on: October 28, 2008, 12:49:01 PM »

My Problem was a hyphen placement in the combobox add item statement(see underlined). Once Removed, Problem solved..


Sub UserForm_Initialize()

'Combobox Ebtron Choices

    ComboBox_gt_ht_st_fan.AddItem "GT 116-F"    'GT 116-F = 0 Case Selection
    ComboBox_gt_ht_st_fan.AddItem "HT 104-F"    'HT 104-F = 1 Case Selection
    ComboBox_gt_ht_st_fan.AddItem "ST 104-F"    'ST-104-F = 2 Case Selection
     
     'ComboBox_gt_ht_st_fan First item static
      ComboBox_gt_ht_st_fan.ListIndex = 0


    ComboBox_gt_116_p.AddItem "GT 116-PD"    'GT 116-PD = 0 Case Selection
    ComboBox_gt_116_p.AddItem "GT 116-PC"    'GT 116-PC = 1 Case Selection
    ComboBox_gt_116_p.AddItem "GT-116-PB"    'GT 116-PB = 2 Case Selection
    ComboBox_gt_116_p.AddItem "GT-116-PA"    'GT 116-PA = 3 Case Selection
   
   
     
     'ComboBox_gt_116_p First item static
      ComboBox_gt_116_p.ListIndex = 0

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: vba-problem
« Reply #5 on: October 28, 2008, 01:52:53 PM »

My Problem was a hyphen placement in the combobox add item statement(see underlined). Once Removed, Problem solved..

Well, now who's fault was that?   :roll: :wink:


Glad you figured it out!
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

krampaul82

  • Guest
Re: vba-problem
« Reply #6 on: October 29, 2008, 01:16:01 PM »

My Problem was a hyphen placement in the combobox add item statement(see underlined). Once Removed, Problem solved..

Well, now who's fault was that?   :roll: :wink:


Glad you figured it out!
Thank You