Microsoft Excel VBA

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • risk32
    New Member
    • Mar 2008
    • 98

    #1

    Microsoft Excel VBA

    I have, at the very least a troublesome program I'm creating. I have somewhat of a prehistoric calender setup with radio buttons for 01-31 (representing the days of the month), January - December, and a small text box for input for the year (last 2 chars only ie. 08, 09). There is also a 'Go' button on the 3rd page, which I was trying to use to shell out to PowerPoint, using the value for the label as the path.
    Everything seems to work just fine, except the last steps to complete the task of taking the value of each button and changing the value of a label to reflect what day/month/year has been selected for the label plus the coding for the shell commmand.

    I am at best a noob programmer, but I have the basic concepts down.

    Here is what I have so far (pictures emailed upon request) :
    Code:
     Private Sub cmdBack_Click()
    MultiPage1.Value = 0
    End Sub
    
    Private Sub cmdNext_Click()
    MultiPage1.Value = 1
    End Sub
    
    Private Sub cmdGenerate_Click()
    MultiPage1.Value = 2
    lblLink = "\\yofs13\374OG\36AS\Asgard_data\data\Duty Desk\Electronic Boards Info\Schedule Slides\2008\" + strMonthFull + "\" + strDay + " " + strMonthAbb + " " + txtYear.Text + ".ppt"
    End Sub
    
    Private Sub Form_Load()
    Page1.SetFocus
    Dim str01 As String
    Dim str02 As String
    Dim str03 As String
    Dim str04 As String
    Dim str05 As String
    Dim str06 As String
    Dim str07 As String
    Dim str08 As String
    Dim str09 As String
    Dim str10 As String
    Dim str11 As String
    Dim str12 As String
    Dim str13 As String
    Dim str14 As String
    Dim str15 As String
    Dim str16 As String
    Dim str17 As String
    Dim str18 As String
    Dim str19 As String
    Dim str20 As String
    Dim str21 As String
    Dim str22 As String
    Dim str23 As String
    Dim str24 As String
    Dim str25 As String
    Dim str26 As String
    Dim str27 As String
    Dim str28 As String
    Dim str29 As String
    Dim str30 As String
    Dim str31 As String
    Dim strMonthFull As String
    Dim strMonthAbb As String
    Dim strDay As String
    
    End Sub
    Private Sub txtYear_click()
    txtYear.MaxLength = 2
    If txtYear = "" Then
    MsgBox "Please enter a year"
    txtYear.SetFocus
    End Sub
    Private Sub cmdGo_Click()
    End Sub
    
    Private Sub opt1_Click()
    If opt1.Value = True Then
    str01 = "01"
    str01 = strDay
    End If
    End Sub
    Private Sub opt2_Click()
    If opt2.Value = True Then
    str02 = "02"
    str01 = strDay
    End If
    End Sub
    Private Sub opt3_Click()
    If opt2.Value = True Then
    str03 = "03"
    str03 = strDay
    End Sub
    Private Sub opt4_Click()
    If opt4.Value = True Then
    str04 = "04"
    str04 = strDay
    End If
    End Sub
    Private Sub opt5_Click()
    If opt5.Value = True Then
    str05 = "05"
    str05 = strDay
    End If
    End Sub
    Private Sub opt6_Click()
    If opt6.Value = True Then
    str06 = "06"
    str06 = strDay
    End Sub
    Private Sub opt7_Click()
    If opt7.Value = True Then
    str07 = "07"
    str07 = strDay
    End If
    End Sub
    Private Sub opt8_Click()
    If opt8.Value = True Then
    str08 = "08"
    str08 = strDay
    End If
    End Sub
    Private Sub opt9_Click()
    If opt9 = True Then
    str09 = "09"
    str09 = strDay
    End If
    End Sub
    Private Sub opt10_Click()
    If opt10.Value = True Then
    str10 = "10"
    str10 = strDay
    End If
    End Sub
    Private Sub opt11_Click()
    If opt11.Value = True Then
    str11 = "11"
    str11 = strDay
    End If
    End Sub
    Private Sub opt12_Click()
    If opt11.Value = True Then
    str12 = "12"
    str12 = strDay
    End If
    End Sub
    Private Sub opt13_Click()
    If opt13.Value = True Then
    str13 = "13"
    str13 = strDay
    End If
    End Sub
    Private Sub opt14_Click()
    If opt14.Value = True Then
    str14 = "14"
    str14 = strDay
    End If
    End Sub
    Private Sub opt15_Click()
    If opt15.Value = True Then
    str15 = "15"
    str15 = strDay
    End If
    End Sub
    Private Sub opt16_Click()
    If opt16.Value = True Then
    str16 = "16"
    str16 = strDay
    End If
    End Sub
    Private Sub opt17_Click()
    If opt17.Value = True Then
    str17 = "17"
    str17 = strDay
    End If
    End Sub
    Private Sub opt18_Click()
    If opt18.Value = True Then
    str18 = "18"
    str18 = strDay
    End If
    End Sub
    Private Sub opt19_Click()
    If opt19.Value = True Then
    str19 = "19"
    str19 = strDay
    End If
    End Sub
    Private Sub opt20_Click()
    If opt20.Value = True Then
    str20 = "20"
    str20 = strDay
    End If
    End Sub
    Private Sub opt21_Click()
    If opt21.Value = True Then
    str21 = "21"
    str21 = strDay
    End If
    End Sub
    Private Sub opt22_Click()
    If opt22.Value = True Then
    str22 = "22"
    str22 = strDay
    End If
    End Sub
    Private Sub opt23_Click()
    If opt23.Value = True Then
    str23 = "23"
    str23 = strDay
    End If
    End Sub
    Private Sub opt24_Click()
    If opt24.Value = True Then
    str24 = "24"
    str24 = strDay
    End If
    End Sub
    Private Sub opt25_Click()
    If opt25.Value = True Then
    str25 = "25"
    str25 = strDay
    End If
    End Sub
    Private Sub opt26_Click()
    If opt26.Value = True Then
    str26 = "26"
    str26 = strDay
    End If
    End Sub
    Private Sub opt27_Click()
    If opt27.Value = True Then
    str27 = "27"
    str27 = strDay
    End If
    End Sub
    Private Sub opt28_Click()
    If opt28.Value = True Then
    str28 = "28"
    str28 = strDay
    End If
    End Sub
    Private Sub opt29_Click()
    If opt29.Value = True Then
    str29 = "29"
    str29 = strDay
    End If
    End Sub
    Private Sub opt30_Click()
    If opt30.Value = True Then
    str30 = "30"
    str30 = strDay
    End If
    End Sub
    Private Sub opt31_Click()
    If opt31.Value = True Then
    str31 = "31"
    str31 = strDay
    End If
    End Sub
    
    Private Sub optAirfield_Click()
     lblLink = "\\yofs13\374OG\36AS\Asgard_data\data\Duty Desk\Electronic Boards Info\Schedule Slides\2008\INFO & STATUS\Info And Status.ppt"
     lblLink = lblLink.Caption
    End Sub
    Private Sub optJan_Click()
    If optJan.Value = True Then
    strMonthFull = "JANUARY"
    strMonthAbb = "JAN"
    End If
    End Sub
    Private Sub optFeb_Click()
    If optFeb.Value = True Then
    strMonthFull = "FEBRUARY"
    strMonthAbb = "FEB"
    End If
    End Sub
    Private Sub optMar_Click()
    If optMar.Value = True Then
    strMonthFull = "MARCH"
    strMonthAbb = "MAR"
    End If
    End Sub
    Private Sub optApr_Click()
    If optApr.Value = True Then
    strMonthFull = "APRIL"
    strMonthAbb = "APR"
    End If
    End Sub
    Private Sub optMay_Click()
    If optMay.Value = True Then
    strMonthFull = "MAY"
    strMonthAbb = "MAY"
    End If
    End Sub
    Private Sub optJun_Click()
    If optJun.Value = True Then
    strMonthFull = "JUNE"
    strMonthAbb = "JUN"
    End If
    End Sub
    Private Sub optJul_Click()
    If optJul.Value = True Then
    strMonthFull = "JULY"
    strMonthAbb = "JUL"
    End If
    End Sub
    Private Sub optAug_Click()
    If optAug.Value = True Then
    strMonthFull = "AUGUST"
    strMonthAbb = "AUG"
    End If
    End Sub
    Private Sub optSep_Click()
    If optSep.Value = True Then
    strMonthFull = "SEPTEMBER"
    strMonthAbb = "SEP"
    End If
    End Sub
    Private Sub optOct_Click()
    If optOct.Value = True Then
    strMonthFull = "OCTOBER"
    strMonthAbb = "OCT"
    End If
    End Sub
    Private Sub optNov_Click()
    If optNov.Value = True Then
    strMonthFull = "NOVEMBER"
    strMonthAbb = "NOV"
    End If
    End Sub
    Private Sub optDec_Click()
    If optDec.Value = True Then
    strMonthFull = "DECEMBER"
    strMonthAbb = "DEC"
    End If
    End Sub
    Private Sub optSched_Click()
     lblLink.Caption = "\\yofs13\374OG\36AS\Asgard_data\data\Duty Desk\Electronic Boards Info\Schedule Slides\2008\"
     End Sub
    [
  • risk32
    New Member
    • Mar 2008
    • 98

    #2
    At the very least, with the code I'm trying to create, there will be 365 possible links available. I've even tried using variables (ie. varDay, varMonthFull, varMonthAbb) and the only thing that shows with the link is the Airfield and Schedule main caption with the first radio buttons. It would probably help if I could include pictures with it to show what I'm looking at, but I'm not exactly sure how to do that with this forum.

    Comment

    Working...