m_court15
06-22-2011, 06:18 AM
I am trying to create a userform with a Save As button and Open button. I want the Save As button to save the data to some type of sheet that can be opened at a later time and repopulate the userform. With that said, I want to have an open button in my userform that will open one of these files and repopulate the correct boxes. I need to create a "database" that can be accessed at a later date.
I am kind of at a stand still right now. Any help would be greatly appreciated.
Option Explicit
Private oVars As Variables
Private Sub cmdBack_Click()
'GOES BACK TO MAIN MENU
Unload Me
MainMenu.Show
End Sub
Private Sub cmdAddSave_click()
'POPULATES DOCUMENT WITH VARIABLES
Set oVars = ActiveDocument.Variables
oVars("DieType").Value = "Pultrusion HV Die Inspection form"
oVars("DieNo").Value = Me.cboDieNo
oVars("RunDate").Value = Me.txtRunDate
oVars("DieInternalSuraface").Value = Me.txtDieInternalSuraface
oVars("InternalDamage").Value = Me.txtInternalDamage
oVars("InternalChrome").Value = Me.txtInternalChrome
oVars("InternalSurface").Value = Me.txtInternalSurface
oVars("AFace").Value = Me.txtAFace
oVars("ADamage").Value = Me.txtADamage
oVars("AChrome").Value = Me.txtAChrome
oVars("ASurface").Value = Me.txtASurface
oVars("BFace").Value = Me.txtBFace
oVars("BDamage").Value = Me.txtBDamage
oVars("BChrome").Value = Me.txtBChrome
oVars("BSurface").Value = Me.txtBSurface
oVars("SF4").Value = Me.txtSF4
oVars("SF5").Value = Me.txtSF5
oVars("SF6").Value = Me.txtSF6
oVars("CT4").Value = Me.txtCT4
oVars("CT5").Value = Me.txtCT5
oVars("CT6").Value = Me.txtCT6
oVars("AP1").Value = Me.txtAP1
oVars("AP2").Value = Me.txtAP2
oVars("AP3").Value = Me.txtAP3
oVars("AP4").Value = Me.txtAP4
oVars("AP5").Value = Me.txtAP5
oVars("AP6").Value = Me.txtAp6
oVars("AP7").Value = Me.txtAP7
oVars("AP8").Value = Me.txtAP8
oVars("AP9").Value = Me.txtAP9
oVars("AP10").Value = Me.txtAP10
oVars("AP11").Value = Me.txtAP11
oVars("AP12").Value = Me.txtAP12
oVars("AP13").Value = Me.txtAP13
oVars("AP14").Value = Me.txtAP14
oVars("AP15").Value = Me.txtAP15
oVars("DieCondition").Value = Me.cboDieCondition
oVars("Description").Value = Me.txtDescription
oVars("Size").Value = Me.txtSize
'LEAVES FIELD BLANK IF NOTHING IS ENTERED
If Me.txtAP15 = "" Then
oVars("AP15").Value = " "
Else
oVars("AP15").Value = Me.txtAP15
End If
If Me.txtAP14 = "" Then
oVars("AP14").Value = " "
Else
oVars("AP14").Value = Me.txtAP14
End If
If Me.txtAP13 = "" Then
oVars("AP13").Value = " "
Else
oVars("AP13").Value = Me.txtAP13
End If
If Me.txtAP12 = "" Then
oVars("AP12").Value = " "
Else
oVars("AP12").Value = Me.txtAP12
End If
If Me.txtAP11 = "" Then
oVars("AP11").Value = " "
Else
oVars("AP11").Value = Me.txtAP11
End If
If Me.txtAP10 = "" Then
oVars("AP10").Value = " "
Else
oVars("AP10").Value = Me.txtAP10
End If
If Me.txtAP9 = "" Then
oVars("AP9").Value = " "
Else
oVars("AP9").Value = Me.txtAP9
End If
If Me.txtAP8 = "" Then
oVars("AP8").Value = " "
Else
oVars("AP8").Value = Me.txtAP8
End If
If Me.txtAP7 = "" Then
oVars("AP7").Value = " "
Else
oVars("AP7").Value = Me.txtAP7
End If
If Me.txtAp6 = "" Then
oVars("AP6").Value = " "
Else
oVars("AP6").Value = Me.txtAp6
End If
If Me.txtAP5 = "" Then
oVars("AP5").Value = " "
Else
oVars("AP5").Value = Me.txtAP5
End If
If Me.txtAP4 = "" Then
oVars("AP4").Value = " "
Else
oVars("AP4").Value = Me.txtAP4
End If
If Me.txtAP3 = "" Then
oVars("AP3").Value = " "
Else
oVars("AP3").Value = Me.txtAP3
End If
If Me.txtAP2 = "" Then
oVars("AP2").Value = " "
Else
oVars("AP2").Value = Me.txtAP2
End If
If Me.txtAP1 = "" Then
oVars("AP1").Value = " "
Else
oVars("AP1").Value = Me.txtAP1
End If
If Me.cboDieNo = "" Then
oVars("DieNo").Value = " "
Else
oVars("Dieno").Value = Me.cboDieNo
End If
If Me.txtRunDate = "" Then
oVars("RunDate").Value = " "
Else
oVars("RunDate").Value = Me.txtRunDate
End If
If Me.txtDieInternalSuraface = "" Then
oVars("DieInternalSuraface").Value = " "
Else
oVars("DieInternalSuraface").Value = Me.txtDieInternalSuraface
End If
If Me.txtInternalDamage = "" Then
oVars("InternalDamage").Value = " "
Else
oVars("InternalDamage").Value = Me.txtInternalDamage
End If
If Me.txtInternalChrome = "" Then
oVars("InternalChrome").Value = " "
Else
oVars("InternalChrome").Value = Me.txtInternalChrome
End If
If Me.txtInternalSurface = "" Then
oVars("InternalSurface").Value = " "
Else
oVars("InternalSurface").Value = Me.txtInternalSurface
End If
If Me.txtAFace = "" Then
oVars("AFace").Value = " "
Else
oVars("AFace").Value = Me.txtAFace
End If
If Me.txtADamage = "" Then
oVars("ADamage").Value = " "
Else
oVars("ADamage").Value = Me.txtADamage
End If
If Me.txtAChrome = "" Then
oVars("AChrome").Value = " "
Else
oVars("AChrome").Value = Me.txtAChrome
End If
If Me.txtASurface = "" Then
oVars("ASurface").Value = " "
Else
oVars("ASurface").Value = Me.txtASurface
End If
If Me.txtBFace = "" Then
oVars("BFace").Value = " "
Else
oVars("BFace").Value = Me.txtBFace
End If
If Me.txtBDamage = "" Then
oVars("BDamage").Value = " "
Else
oVars("BDamage").Value = Me.txtBDamage
End If
If Me.txtBChrome = "" Then
oVars("BChrome").Value = " "
Else
oVars("BChrome").Value = Me.txtBChrome
End If
If Me.txtBSurface = "" Then
oVars("BSurface").Value = " "
Else
oVars("BSurface").Value = Me.txtBSurface
End If
If Me.txtCT6 = "" Then
oVars("CT6").Value = " "
Else
oVars("CT6").Value = Me.txtCT6
End If
If Me.txtCT5 = "" Then
oVars("CT5").Value = " "
Else
oVars("CT5").Value = Me.txtCT5
End If
If Me.txtCT4 = "" Then
oVars("CT4").Value = " "
Else
oVars("CT4").Value = Me.txtCT4
End If
If Me.txtSF6 = "" Then
oVars("SF6").Value = " "
Else
oVars("SF6").Value = Me.txtSF6
End If
If Me.txtSF5 = "" Then
oVars("SF5").Value = " "
Else
oVars("SF5").Value = Me.txtSF5
End If
If Me.txtSF4 = "" Then
oVars("SF4").Value = " "
Else
oVars("SF4").Value = Me.txtSF4
End If
If Me.cboDieCondition = "" Then
oVars("DieCondition").Value = " "
Else
oVars("DieCondition").Value = Me.cboDieCondition
End If
If Me.txtDescription = "" Then
oVars("description").Value = " "
Else
oVars("Description").Value = Me.txtDescription
End If
If Me.txtSize = "" Then
oVars("Size").Value = " "
Else
oVars("Size").Value = Me.txtSize
End If
If labelHVDie = "Pultrusion HV Die Inspection Form" Then
ActiveDocument.Bookmarks("sig").Range.InlineShapes.AddPicture "C:\Users\Matt Courtright\Documents\pultrusion form\HV Die.jpg" '.linktofile:=False,savewithdocument:=True
End If
ActiveDocument.Fields.Update
Set oVars = Nothing
Unload Me
'OPENS SAVE AS DIALOG BOX
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogSaveAs)
'SAVE AS FILE NAME AND TYPE
With fd
If cboDieCondition = "Good Two Ends" Then
.InitialFileName = Me.cboDieNo & "_GoodTwoEnds_" & Format(Date, "MMMddYYYY")
End If
If cboDieCondition = "Good One End" Then
.InitialFileName = Me.cboDieNo & "_GoodOneEnd_" & Format(Date, "MMMddYYYY")
End If
If cboDieCondition = "Backup Only" Then
.InitialFileName = Me.cboDieNo & "_BackupOnly_" & Format(Date, "MMMddYYYY")
End If
If cboDieCondition = "Bad" Then
.InitialFileName = Me.cboDieNo & "_Bad_" & Format(Date, "MMMddYYYY")
End If
.InitialFileName = Me.cboDieNo & "_Round_" & Format(Date, "MMMddYYYY")
If .Show = 0 Then 'user pressed the cancel button
Else
.Execute
End If
End With
Set fd = Nothing
End Sub
Private Sub cmdClear_Click()
'CLEARS VALUES
cboDieNo.Value = Null
cboDieCondition.Value = Null
txtSize.Value = Null
txtDescription.Value = Null
txtRunDate.Value = Null
txtDieInternalSuraface.Value = Null
txtInternalDamage.Value = Null
txtInternalChrome.Value = Null
txtInternalSurface.Value = Null
txtAFace.Value = Null
txtADamage.Value = Null
txtAChrome.Value = Null
txtASurface.Value = Null
txtBFace.Value = Null
txtBDamage.Value = Null
txtBChrome.Value = Null
txtBSurface.Value = Null
txtSF4.Value = Null
txtSF5.Value = Null
txtSF6.Value = Null
txtCT4.Value = Null
txtCT5.Value = Null
txtCT6.Value = Null
txtAP1.Value = Null
txtAP2.Value = Null
txtAP3.Value = Null
txtAP4.Value = Null
txtAP5.Value = Null
txtAp6.Value = Null
txtAP7.Value = Null
txtAP8.Value = Null
txtAP9.Value = Null
txtAP10.Value = Null
txtAP11.Value = Null
txtAP12.Value = Null
txtAP13.Value = Null
txtAP14.Value = Null
txtAP15.Value = Null
End Sub
Private Sub cmdCancel_Click()
'CLOSES FORM WITH OUT SAVING
Unload Me
ActiveDocument.Close SaveChanges:=False
End Sub
Private Sub UserForm_Initialize()
'ADDS ITEMS TO DROP DOWN BOXES
With cboDieNo
.AddItem "101"
.AddItem "102"
.AddItem "103"
.AddItem "104"
.AddItem "201"
.AddItem "202"
.AddItem "203"
.AddItem "301"
.AddItem "302"
.AddItem "303"
.AddItem "304"
.AddItem "401"
.AddItem "402"
.AddItem "403XXXX"
.AddItem "501"
.AddItem "502"
.AddItem "503"
.AddItem "601"
.AddItem "602"
.AddItem "603"
.AddItem "604"
.AddItem "701"
.AddItem "702"
.AddItem "703"
.AddItem "704"
.AddItem "801"
.AddItem "802"
.AddItem "803"
.AddItem "901"
.AddItem "902"
End With
With cboDieCondition
.AddItem "Good One End"
.AddItem "good Two Ends"
.AddItem "Backup Only"
.AddItem "Bad"
End With
End Sub
Private Sub cboDieNo_Change()
'CHANGES DESCRIPTION DEPENDING ON DIE NO. SELECTION
If cboDieNo.Value = "101" Then
txtDescription.Value = "HV-TP, 1.145 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "102" Then
txtDescription.Value = "HV-TP, 1.145 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "103" Then
txtDescription.Value = "HV-TP, 1.145 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "104" Then
txtDescription.Value = "HV-TP, 1.145 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "201" Then
txtDescription.Value = "HV-TP, 1.30 ID"
txtSize.Value = "5 x 5 x 48"
End If
If cboDieNo.Value = "202" Then
txtDescription.Value = "HV-TP, 1.30 ID"
txtSize.Value = "5 x 5 x 48"
End If
If cboDieNo.Value = "203" Then
txtDescription.Value = "HV-TP, 1.30 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "301" Then
txtDescription.Value = "HV-TP, 1.455 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "302" Then
txtDescription.Value = "HV-TP, 1.455 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "303" Then
txtDescription.Value = "HV-TP, 1.455 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "304" Then
txtDescription.Value = "HV-TP, 1.455 ID"
txtSize.Value = "5 x 5 x 48"
End If
If cboDieNo.Value = "401" Then
txtDescription.Value = "HV-TP, 1.61 ID"
txtSize.Value = "5 x 5 x 48"
End If
If cboDieNo.Value = "402" Then
txtDescription.Value = "HV-TP, 1.61 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "403XXXX" Then
txtDescription.Value = "HV-TP, 1.61 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "501" Then
txtDescription.Value = "HV-TP, 1.765 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "502" Then
txtDescription.Value = "HV-TP, 1.765 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "503" Then
txtDescription.Value = "HV-TP, 1.765 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "601" Then
txtDescription.Value = "HV-TP, 1.92 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "602" Then
txtDescription.Value = "HV-TP, 1.765 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "603" Then
txtDescription.Value = "HV-TP, 1.765 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "604" Then
txtDescription.Value = "HV-TP, 1.765 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "701" Then
txtDescription.Value = "HV-TP, 2.075 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "702" Then
txtDescription.Value = "HV-TP, 2.075 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "703" Then
txtDescription.Value = "HV-TP, 2.075 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "704" Then
txtDescription.Value = "HV-TP, 2.075 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "801" Then
txtDescription.Value = "HV-TP, 2.23 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "802" Then
txtDescription.Value = "HV-TP, 2.23 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "803" Then
txtDescription.Value = "HV-TP, 2.23 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "901" Then
txtDescription.Value = "HV-TP, 2.385 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "902" Then
txtDescription.Value = "HV-TP, 2.385 ID"
txtSize.Value = "5 x 5 x 36"
End If
End Sub
thanks for your help,
-Matt
I am kind of at a stand still right now. Any help would be greatly appreciated.
Option Explicit
Private oVars As Variables
Private Sub cmdBack_Click()
'GOES BACK TO MAIN MENU
Unload Me
MainMenu.Show
End Sub
Private Sub cmdAddSave_click()
'POPULATES DOCUMENT WITH VARIABLES
Set oVars = ActiveDocument.Variables
oVars("DieType").Value = "Pultrusion HV Die Inspection form"
oVars("DieNo").Value = Me.cboDieNo
oVars("RunDate").Value = Me.txtRunDate
oVars("DieInternalSuraface").Value = Me.txtDieInternalSuraface
oVars("InternalDamage").Value = Me.txtInternalDamage
oVars("InternalChrome").Value = Me.txtInternalChrome
oVars("InternalSurface").Value = Me.txtInternalSurface
oVars("AFace").Value = Me.txtAFace
oVars("ADamage").Value = Me.txtADamage
oVars("AChrome").Value = Me.txtAChrome
oVars("ASurface").Value = Me.txtASurface
oVars("BFace").Value = Me.txtBFace
oVars("BDamage").Value = Me.txtBDamage
oVars("BChrome").Value = Me.txtBChrome
oVars("BSurface").Value = Me.txtBSurface
oVars("SF4").Value = Me.txtSF4
oVars("SF5").Value = Me.txtSF5
oVars("SF6").Value = Me.txtSF6
oVars("CT4").Value = Me.txtCT4
oVars("CT5").Value = Me.txtCT5
oVars("CT6").Value = Me.txtCT6
oVars("AP1").Value = Me.txtAP1
oVars("AP2").Value = Me.txtAP2
oVars("AP3").Value = Me.txtAP3
oVars("AP4").Value = Me.txtAP4
oVars("AP5").Value = Me.txtAP5
oVars("AP6").Value = Me.txtAp6
oVars("AP7").Value = Me.txtAP7
oVars("AP8").Value = Me.txtAP8
oVars("AP9").Value = Me.txtAP9
oVars("AP10").Value = Me.txtAP10
oVars("AP11").Value = Me.txtAP11
oVars("AP12").Value = Me.txtAP12
oVars("AP13").Value = Me.txtAP13
oVars("AP14").Value = Me.txtAP14
oVars("AP15").Value = Me.txtAP15
oVars("DieCondition").Value = Me.cboDieCondition
oVars("Description").Value = Me.txtDescription
oVars("Size").Value = Me.txtSize
'LEAVES FIELD BLANK IF NOTHING IS ENTERED
If Me.txtAP15 = "" Then
oVars("AP15").Value = " "
Else
oVars("AP15").Value = Me.txtAP15
End If
If Me.txtAP14 = "" Then
oVars("AP14").Value = " "
Else
oVars("AP14").Value = Me.txtAP14
End If
If Me.txtAP13 = "" Then
oVars("AP13").Value = " "
Else
oVars("AP13").Value = Me.txtAP13
End If
If Me.txtAP12 = "" Then
oVars("AP12").Value = " "
Else
oVars("AP12").Value = Me.txtAP12
End If
If Me.txtAP11 = "" Then
oVars("AP11").Value = " "
Else
oVars("AP11").Value = Me.txtAP11
End If
If Me.txtAP10 = "" Then
oVars("AP10").Value = " "
Else
oVars("AP10").Value = Me.txtAP10
End If
If Me.txtAP9 = "" Then
oVars("AP9").Value = " "
Else
oVars("AP9").Value = Me.txtAP9
End If
If Me.txtAP8 = "" Then
oVars("AP8").Value = " "
Else
oVars("AP8").Value = Me.txtAP8
End If
If Me.txtAP7 = "" Then
oVars("AP7").Value = " "
Else
oVars("AP7").Value = Me.txtAP7
End If
If Me.txtAp6 = "" Then
oVars("AP6").Value = " "
Else
oVars("AP6").Value = Me.txtAp6
End If
If Me.txtAP5 = "" Then
oVars("AP5").Value = " "
Else
oVars("AP5").Value = Me.txtAP5
End If
If Me.txtAP4 = "" Then
oVars("AP4").Value = " "
Else
oVars("AP4").Value = Me.txtAP4
End If
If Me.txtAP3 = "" Then
oVars("AP3").Value = " "
Else
oVars("AP3").Value = Me.txtAP3
End If
If Me.txtAP2 = "" Then
oVars("AP2").Value = " "
Else
oVars("AP2").Value = Me.txtAP2
End If
If Me.txtAP1 = "" Then
oVars("AP1").Value = " "
Else
oVars("AP1").Value = Me.txtAP1
End If
If Me.cboDieNo = "" Then
oVars("DieNo").Value = " "
Else
oVars("Dieno").Value = Me.cboDieNo
End If
If Me.txtRunDate = "" Then
oVars("RunDate").Value = " "
Else
oVars("RunDate").Value = Me.txtRunDate
End If
If Me.txtDieInternalSuraface = "" Then
oVars("DieInternalSuraface").Value = " "
Else
oVars("DieInternalSuraface").Value = Me.txtDieInternalSuraface
End If
If Me.txtInternalDamage = "" Then
oVars("InternalDamage").Value = " "
Else
oVars("InternalDamage").Value = Me.txtInternalDamage
End If
If Me.txtInternalChrome = "" Then
oVars("InternalChrome").Value = " "
Else
oVars("InternalChrome").Value = Me.txtInternalChrome
End If
If Me.txtInternalSurface = "" Then
oVars("InternalSurface").Value = " "
Else
oVars("InternalSurface").Value = Me.txtInternalSurface
End If
If Me.txtAFace = "" Then
oVars("AFace").Value = " "
Else
oVars("AFace").Value = Me.txtAFace
End If
If Me.txtADamage = "" Then
oVars("ADamage").Value = " "
Else
oVars("ADamage").Value = Me.txtADamage
End If
If Me.txtAChrome = "" Then
oVars("AChrome").Value = " "
Else
oVars("AChrome").Value = Me.txtAChrome
End If
If Me.txtASurface = "" Then
oVars("ASurface").Value = " "
Else
oVars("ASurface").Value = Me.txtASurface
End If
If Me.txtBFace = "" Then
oVars("BFace").Value = " "
Else
oVars("BFace").Value = Me.txtBFace
End If
If Me.txtBDamage = "" Then
oVars("BDamage").Value = " "
Else
oVars("BDamage").Value = Me.txtBDamage
End If
If Me.txtBChrome = "" Then
oVars("BChrome").Value = " "
Else
oVars("BChrome").Value = Me.txtBChrome
End If
If Me.txtBSurface = "" Then
oVars("BSurface").Value = " "
Else
oVars("BSurface").Value = Me.txtBSurface
End If
If Me.txtCT6 = "" Then
oVars("CT6").Value = " "
Else
oVars("CT6").Value = Me.txtCT6
End If
If Me.txtCT5 = "" Then
oVars("CT5").Value = " "
Else
oVars("CT5").Value = Me.txtCT5
End If
If Me.txtCT4 = "" Then
oVars("CT4").Value = " "
Else
oVars("CT4").Value = Me.txtCT4
End If
If Me.txtSF6 = "" Then
oVars("SF6").Value = " "
Else
oVars("SF6").Value = Me.txtSF6
End If
If Me.txtSF5 = "" Then
oVars("SF5").Value = " "
Else
oVars("SF5").Value = Me.txtSF5
End If
If Me.txtSF4 = "" Then
oVars("SF4").Value = " "
Else
oVars("SF4").Value = Me.txtSF4
End If
If Me.cboDieCondition = "" Then
oVars("DieCondition").Value = " "
Else
oVars("DieCondition").Value = Me.cboDieCondition
End If
If Me.txtDescription = "" Then
oVars("description").Value = " "
Else
oVars("Description").Value = Me.txtDescription
End If
If Me.txtSize = "" Then
oVars("Size").Value = " "
Else
oVars("Size").Value = Me.txtSize
End If
If labelHVDie = "Pultrusion HV Die Inspection Form" Then
ActiveDocument.Bookmarks("sig").Range.InlineShapes.AddPicture "C:\Users\Matt Courtright\Documents\pultrusion form\HV Die.jpg" '.linktofile:=False,savewithdocument:=True
End If
ActiveDocument.Fields.Update
Set oVars = Nothing
Unload Me
'OPENS SAVE AS DIALOG BOX
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogSaveAs)
'SAVE AS FILE NAME AND TYPE
With fd
If cboDieCondition = "Good Two Ends" Then
.InitialFileName = Me.cboDieNo & "_GoodTwoEnds_" & Format(Date, "MMMddYYYY")
End If
If cboDieCondition = "Good One End" Then
.InitialFileName = Me.cboDieNo & "_GoodOneEnd_" & Format(Date, "MMMddYYYY")
End If
If cboDieCondition = "Backup Only" Then
.InitialFileName = Me.cboDieNo & "_BackupOnly_" & Format(Date, "MMMddYYYY")
End If
If cboDieCondition = "Bad" Then
.InitialFileName = Me.cboDieNo & "_Bad_" & Format(Date, "MMMddYYYY")
End If
.InitialFileName = Me.cboDieNo & "_Round_" & Format(Date, "MMMddYYYY")
If .Show = 0 Then 'user pressed the cancel button
Else
.Execute
End If
End With
Set fd = Nothing
End Sub
Private Sub cmdClear_Click()
'CLEARS VALUES
cboDieNo.Value = Null
cboDieCondition.Value = Null
txtSize.Value = Null
txtDescription.Value = Null
txtRunDate.Value = Null
txtDieInternalSuraface.Value = Null
txtInternalDamage.Value = Null
txtInternalChrome.Value = Null
txtInternalSurface.Value = Null
txtAFace.Value = Null
txtADamage.Value = Null
txtAChrome.Value = Null
txtASurface.Value = Null
txtBFace.Value = Null
txtBDamage.Value = Null
txtBChrome.Value = Null
txtBSurface.Value = Null
txtSF4.Value = Null
txtSF5.Value = Null
txtSF6.Value = Null
txtCT4.Value = Null
txtCT5.Value = Null
txtCT6.Value = Null
txtAP1.Value = Null
txtAP2.Value = Null
txtAP3.Value = Null
txtAP4.Value = Null
txtAP5.Value = Null
txtAp6.Value = Null
txtAP7.Value = Null
txtAP8.Value = Null
txtAP9.Value = Null
txtAP10.Value = Null
txtAP11.Value = Null
txtAP12.Value = Null
txtAP13.Value = Null
txtAP14.Value = Null
txtAP15.Value = Null
End Sub
Private Sub cmdCancel_Click()
'CLOSES FORM WITH OUT SAVING
Unload Me
ActiveDocument.Close SaveChanges:=False
End Sub
Private Sub UserForm_Initialize()
'ADDS ITEMS TO DROP DOWN BOXES
With cboDieNo
.AddItem "101"
.AddItem "102"
.AddItem "103"
.AddItem "104"
.AddItem "201"
.AddItem "202"
.AddItem "203"
.AddItem "301"
.AddItem "302"
.AddItem "303"
.AddItem "304"
.AddItem "401"
.AddItem "402"
.AddItem "403XXXX"
.AddItem "501"
.AddItem "502"
.AddItem "503"
.AddItem "601"
.AddItem "602"
.AddItem "603"
.AddItem "604"
.AddItem "701"
.AddItem "702"
.AddItem "703"
.AddItem "704"
.AddItem "801"
.AddItem "802"
.AddItem "803"
.AddItem "901"
.AddItem "902"
End With
With cboDieCondition
.AddItem "Good One End"
.AddItem "good Two Ends"
.AddItem "Backup Only"
.AddItem "Bad"
End With
End Sub
Private Sub cboDieNo_Change()
'CHANGES DESCRIPTION DEPENDING ON DIE NO. SELECTION
If cboDieNo.Value = "101" Then
txtDescription.Value = "HV-TP, 1.145 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "102" Then
txtDescription.Value = "HV-TP, 1.145 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "103" Then
txtDescription.Value = "HV-TP, 1.145 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "104" Then
txtDescription.Value = "HV-TP, 1.145 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "201" Then
txtDescription.Value = "HV-TP, 1.30 ID"
txtSize.Value = "5 x 5 x 48"
End If
If cboDieNo.Value = "202" Then
txtDescription.Value = "HV-TP, 1.30 ID"
txtSize.Value = "5 x 5 x 48"
End If
If cboDieNo.Value = "203" Then
txtDescription.Value = "HV-TP, 1.30 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "301" Then
txtDescription.Value = "HV-TP, 1.455 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "302" Then
txtDescription.Value = "HV-TP, 1.455 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "303" Then
txtDescription.Value = "HV-TP, 1.455 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "304" Then
txtDescription.Value = "HV-TP, 1.455 ID"
txtSize.Value = "5 x 5 x 48"
End If
If cboDieNo.Value = "401" Then
txtDescription.Value = "HV-TP, 1.61 ID"
txtSize.Value = "5 x 5 x 48"
End If
If cboDieNo.Value = "402" Then
txtDescription.Value = "HV-TP, 1.61 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "403XXXX" Then
txtDescription.Value = "HV-TP, 1.61 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "501" Then
txtDescription.Value = "HV-TP, 1.765 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "502" Then
txtDescription.Value = "HV-TP, 1.765 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "503" Then
txtDescription.Value = "HV-TP, 1.765 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "601" Then
txtDescription.Value = "HV-TP, 1.92 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "602" Then
txtDescription.Value = "HV-TP, 1.765 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "603" Then
txtDescription.Value = "HV-TP, 1.765 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "604" Then
txtDescription.Value = "HV-TP, 1.765 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "701" Then
txtDescription.Value = "HV-TP, 2.075 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "702" Then
txtDescription.Value = "HV-TP, 2.075 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "703" Then
txtDescription.Value = "HV-TP, 2.075 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "704" Then
txtDescription.Value = "HV-TP, 2.075 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "801" Then
txtDescription.Value = "HV-TP, 2.23 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "802" Then
txtDescription.Value = "HV-TP, 2.23 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "803" Then
txtDescription.Value = "HV-TP, 2.23 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "901" Then
txtDescription.Value = "HV-TP, 2.385 ID"
txtSize.Value = "5 x 5 x 36"
End If
If cboDieNo.Value = "902" Then
txtDescription.Value = "HV-TP, 2.385 ID"
txtSize.Value = "5 x 5 x 36"
End If
End Sub
thanks for your help,
-Matt