Conditional checkbox options in Excel form









up vote
0
down vote

favorite












This question is rather outside my skill range - I've never worked with buttons or checkboxes before in a 'live' form. I've combined two excel forms together to create one main form. While very similar, the form for California has additional options to check for its Provider List Type that the National form does not.



enter image description here



What I would like to be able to do is select California at the top, and have Regional Provider List and California Full List (CD) be available as options, whereas if I select National, they are not available. Lots of different people will use this form so I need to ensure they can't click whatever they want. I'm not a strong coder, someone else built the forms, I just frankensteined them together. Most of the solutions I've encountered that I can understand are for ActiveX controls and I've used simple Form controls. I also apologize for posting the entire code, I'm not entirely sure where to insert the checkbox control code. If anyone has a good resource on this subject for newbies they can recommend, I would be very appreciative to digest it.



Option Explicit

Function checkComplete()

'Dim TextBox1 As OLEObject

If IsEmpty(Range("I6")) Then
MsgBox "Please enter the Claimant Name."
Range("I6").Select
checkComplete = False
ElseIf IsEmpty(Range("I8")) Then
MsgBox "Please enter the Claim #."
Range("I8").Select
checkComplete = False
ElseIf IsEmpty(Range("AF6")) Then
MsgBox "Please enter the Date that the list is needed by."
Range("AF6").Select
checkComplete = False
'ElseIf TextBox1.Text = "" Then
'MsgBox "Please enter a description."
'TextBox1.Select
'checkComplete = False
Else
checkComplete = True
End If

End Function

Sub submitForm()

If checkComplete = False Then Exit Sub

Dim thisWb As Workbook, wbTemp As Workbook
Dim ws As Worksheet

Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False

Set thisWb = ThisWorkbook
Set wbTemp = Workbooks.Add

'Save Network Development Form worksheet to new workbook.
'Needs to be copied from an xltm to an xlsx workbook in order to email a good xlsx file that is not corrupt.
thisWb.Sheets(1).Copy After:=wbTemp.Sheets(3)

For Each ws In wbTemp.Worksheets
If ws.Name <> "Network Development Form" Then
ws.Delete
End If
Next

ActiveWindow.ScrollRow = 1

'Save temporary copy of workbook
Dim TempFilePath As String
Dim TempFileName As String
Dim FileExtStr As String

TempFilePath = Environ$("temp") & ""
TempFileName = "Network Development - Claim#" & Range("I8").Value
FileExtStr = ".xlsx"

Set wbTemp = ActiveWorkbook
wbTemp.SaveCopyAs TempFilePath & TempFileName & FileExtStr

'Email copy of form to Networks
Dim outlook As Object
Dim outlookMail As Object
Dim UName As Variant

Set outlook = CreateObject("Outlook.Application")
Set outlookMail = outlook.CreateItem(0)
UName = Environ("UserName")

With outlookMail
.To = ""
.CC = UName & "@auw.com"
.Subject = "Network Development Form"
.Attachments.Add TempFilePath & TempFileName & FileExtStr
.Send '.Display
End With

Kill TempFilePath & TempFileName & FileExtStr

Set outlook = Nothing
Set outlookMail = Nothing

wbTemp.Activate
wbTemp.Close SaveChanges:=False

thisWb.Activate

Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True

thisWb.Close SaveChanges:=False

End Sub









share|improve this question

















  • 1




    if i understood your question you can read this post stackoverflow.com/questions/11991308/… to use checkboxe and display that you want...
    – Ferdinando
    Nov 11 at 21:12











  • @Ferdinando This was very helpful, thank you!
    – BetO
    yesterday










  • you are welcome! :)
    – Ferdinando
    yesterday














up vote
0
down vote

favorite












This question is rather outside my skill range - I've never worked with buttons or checkboxes before in a 'live' form. I've combined two excel forms together to create one main form. While very similar, the form for California has additional options to check for its Provider List Type that the National form does not.



enter image description here



What I would like to be able to do is select California at the top, and have Regional Provider List and California Full List (CD) be available as options, whereas if I select National, they are not available. Lots of different people will use this form so I need to ensure they can't click whatever they want. I'm not a strong coder, someone else built the forms, I just frankensteined them together. Most of the solutions I've encountered that I can understand are for ActiveX controls and I've used simple Form controls. I also apologize for posting the entire code, I'm not entirely sure where to insert the checkbox control code. If anyone has a good resource on this subject for newbies they can recommend, I would be very appreciative to digest it.



Option Explicit

Function checkComplete()

'Dim TextBox1 As OLEObject

If IsEmpty(Range("I6")) Then
MsgBox "Please enter the Claimant Name."
Range("I6").Select
checkComplete = False
ElseIf IsEmpty(Range("I8")) Then
MsgBox "Please enter the Claim #."
Range("I8").Select
checkComplete = False
ElseIf IsEmpty(Range("AF6")) Then
MsgBox "Please enter the Date that the list is needed by."
Range("AF6").Select
checkComplete = False
'ElseIf TextBox1.Text = "" Then
'MsgBox "Please enter a description."
'TextBox1.Select
'checkComplete = False
Else
checkComplete = True
End If

End Function

Sub submitForm()

If checkComplete = False Then Exit Sub

Dim thisWb As Workbook, wbTemp As Workbook
Dim ws As Worksheet

Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False

Set thisWb = ThisWorkbook
Set wbTemp = Workbooks.Add

'Save Network Development Form worksheet to new workbook.
'Needs to be copied from an xltm to an xlsx workbook in order to email a good xlsx file that is not corrupt.
thisWb.Sheets(1).Copy After:=wbTemp.Sheets(3)

For Each ws In wbTemp.Worksheets
If ws.Name <> "Network Development Form" Then
ws.Delete
End If
Next

ActiveWindow.ScrollRow = 1

'Save temporary copy of workbook
Dim TempFilePath As String
Dim TempFileName As String
Dim FileExtStr As String

TempFilePath = Environ$("temp") & ""
TempFileName = "Network Development - Claim#" & Range("I8").Value
FileExtStr = ".xlsx"

Set wbTemp = ActiveWorkbook
wbTemp.SaveCopyAs TempFilePath & TempFileName & FileExtStr

'Email copy of form to Networks
Dim outlook As Object
Dim outlookMail As Object
Dim UName As Variant

Set outlook = CreateObject("Outlook.Application")
Set outlookMail = outlook.CreateItem(0)
UName = Environ("UserName")

With outlookMail
.To = ""
.CC = UName & "@auw.com"
.Subject = "Network Development Form"
.Attachments.Add TempFilePath & TempFileName & FileExtStr
.Send '.Display
End With

Kill TempFilePath & TempFileName & FileExtStr

Set outlook = Nothing
Set outlookMail = Nothing

wbTemp.Activate
wbTemp.Close SaveChanges:=False

thisWb.Activate

Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True

thisWb.Close SaveChanges:=False

End Sub









share|improve this question

















  • 1




    if i understood your question you can read this post stackoverflow.com/questions/11991308/… to use checkboxe and display that you want...
    – Ferdinando
    Nov 11 at 21:12











  • @Ferdinando This was very helpful, thank you!
    – BetO
    yesterday










  • you are welcome! :)
    – Ferdinando
    yesterday












up vote
0
down vote

favorite









up vote
0
down vote

favorite











This question is rather outside my skill range - I've never worked with buttons or checkboxes before in a 'live' form. I've combined two excel forms together to create one main form. While very similar, the form for California has additional options to check for its Provider List Type that the National form does not.



enter image description here



What I would like to be able to do is select California at the top, and have Regional Provider List and California Full List (CD) be available as options, whereas if I select National, they are not available. Lots of different people will use this form so I need to ensure they can't click whatever they want. I'm not a strong coder, someone else built the forms, I just frankensteined them together. Most of the solutions I've encountered that I can understand are for ActiveX controls and I've used simple Form controls. I also apologize for posting the entire code, I'm not entirely sure where to insert the checkbox control code. If anyone has a good resource on this subject for newbies they can recommend, I would be very appreciative to digest it.



Option Explicit

Function checkComplete()

'Dim TextBox1 As OLEObject

If IsEmpty(Range("I6")) Then
MsgBox "Please enter the Claimant Name."
Range("I6").Select
checkComplete = False
ElseIf IsEmpty(Range("I8")) Then
MsgBox "Please enter the Claim #."
Range("I8").Select
checkComplete = False
ElseIf IsEmpty(Range("AF6")) Then
MsgBox "Please enter the Date that the list is needed by."
Range("AF6").Select
checkComplete = False
'ElseIf TextBox1.Text = "" Then
'MsgBox "Please enter a description."
'TextBox1.Select
'checkComplete = False
Else
checkComplete = True
End If

End Function

Sub submitForm()

If checkComplete = False Then Exit Sub

Dim thisWb As Workbook, wbTemp As Workbook
Dim ws As Worksheet

Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False

Set thisWb = ThisWorkbook
Set wbTemp = Workbooks.Add

'Save Network Development Form worksheet to new workbook.
'Needs to be copied from an xltm to an xlsx workbook in order to email a good xlsx file that is not corrupt.
thisWb.Sheets(1).Copy After:=wbTemp.Sheets(3)

For Each ws In wbTemp.Worksheets
If ws.Name <> "Network Development Form" Then
ws.Delete
End If
Next

ActiveWindow.ScrollRow = 1

'Save temporary copy of workbook
Dim TempFilePath As String
Dim TempFileName As String
Dim FileExtStr As String

TempFilePath = Environ$("temp") & ""
TempFileName = "Network Development - Claim#" & Range("I8").Value
FileExtStr = ".xlsx"

Set wbTemp = ActiveWorkbook
wbTemp.SaveCopyAs TempFilePath & TempFileName & FileExtStr

'Email copy of form to Networks
Dim outlook As Object
Dim outlookMail As Object
Dim UName As Variant

Set outlook = CreateObject("Outlook.Application")
Set outlookMail = outlook.CreateItem(0)
UName = Environ("UserName")

With outlookMail
.To = ""
.CC = UName & "@auw.com"
.Subject = "Network Development Form"
.Attachments.Add TempFilePath & TempFileName & FileExtStr
.Send '.Display
End With

Kill TempFilePath & TempFileName & FileExtStr

Set outlook = Nothing
Set outlookMail = Nothing

wbTemp.Activate
wbTemp.Close SaveChanges:=False

thisWb.Activate

Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True

thisWb.Close SaveChanges:=False

End Sub









share|improve this question













This question is rather outside my skill range - I've never worked with buttons or checkboxes before in a 'live' form. I've combined two excel forms together to create one main form. While very similar, the form for California has additional options to check for its Provider List Type that the National form does not.



enter image description here



What I would like to be able to do is select California at the top, and have Regional Provider List and California Full List (CD) be available as options, whereas if I select National, they are not available. Lots of different people will use this form so I need to ensure they can't click whatever they want. I'm not a strong coder, someone else built the forms, I just frankensteined them together. Most of the solutions I've encountered that I can understand are for ActiveX controls and I've used simple Form controls. I also apologize for posting the entire code, I'm not entirely sure where to insert the checkbox control code. If anyone has a good resource on this subject for newbies they can recommend, I would be very appreciative to digest it.



Option Explicit

Function checkComplete()

'Dim TextBox1 As OLEObject

If IsEmpty(Range("I6")) Then
MsgBox "Please enter the Claimant Name."
Range("I6").Select
checkComplete = False
ElseIf IsEmpty(Range("I8")) Then
MsgBox "Please enter the Claim #."
Range("I8").Select
checkComplete = False
ElseIf IsEmpty(Range("AF6")) Then
MsgBox "Please enter the Date that the list is needed by."
Range("AF6").Select
checkComplete = False
'ElseIf TextBox1.Text = "" Then
'MsgBox "Please enter a description."
'TextBox1.Select
'checkComplete = False
Else
checkComplete = True
End If

End Function

Sub submitForm()

If checkComplete = False Then Exit Sub

Dim thisWb As Workbook, wbTemp As Workbook
Dim ws As Worksheet

Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False

Set thisWb = ThisWorkbook
Set wbTemp = Workbooks.Add

'Save Network Development Form worksheet to new workbook.
'Needs to be copied from an xltm to an xlsx workbook in order to email a good xlsx file that is not corrupt.
thisWb.Sheets(1).Copy After:=wbTemp.Sheets(3)

For Each ws In wbTemp.Worksheets
If ws.Name <> "Network Development Form" Then
ws.Delete
End If
Next

ActiveWindow.ScrollRow = 1

'Save temporary copy of workbook
Dim TempFilePath As String
Dim TempFileName As String
Dim FileExtStr As String

TempFilePath = Environ$("temp") & ""
TempFileName = "Network Development - Claim#" & Range("I8").Value
FileExtStr = ".xlsx"

Set wbTemp = ActiveWorkbook
wbTemp.SaveCopyAs TempFilePath & TempFileName & FileExtStr

'Email copy of form to Networks
Dim outlook As Object
Dim outlookMail As Object
Dim UName As Variant

Set outlook = CreateObject("Outlook.Application")
Set outlookMail = outlook.CreateItem(0)
UName = Environ("UserName")

With outlookMail
.To = ""
.CC = UName & "@auw.com"
.Subject = "Network Development Form"
.Attachments.Add TempFilePath & TempFileName & FileExtStr
.Send '.Display
End With

Kill TempFilePath & TempFileName & FileExtStr

Set outlook = Nothing
Set outlookMail = Nothing

wbTemp.Activate
wbTemp.Close SaveChanges:=False

thisWb.Activate

Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True

thisWb.Close SaveChanges:=False

End Sub






excel vba excel-vba






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 9 at 15:06









BetO

213




213







  • 1




    if i understood your question you can read this post stackoverflow.com/questions/11991308/… to use checkboxe and display that you want...
    – Ferdinando
    Nov 11 at 21:12











  • @Ferdinando This was very helpful, thank you!
    – BetO
    yesterday










  • you are welcome! :)
    – Ferdinando
    yesterday












  • 1




    if i understood your question you can read this post stackoverflow.com/questions/11991308/… to use checkboxe and display that you want...
    – Ferdinando
    Nov 11 at 21:12











  • @Ferdinando This was very helpful, thank you!
    – BetO
    yesterday










  • you are welcome! :)
    – Ferdinando
    yesterday







1




1




if i understood your question you can read this post stackoverflow.com/questions/11991308/… to use checkboxe and display that you want...
– Ferdinando
Nov 11 at 21:12





if i understood your question you can read this post stackoverflow.com/questions/11991308/… to use checkboxe and display that you want...
– Ferdinando
Nov 11 at 21:12













@Ferdinando This was very helpful, thank you!
– BetO
yesterday




@Ferdinando This was very helpful, thank you!
– BetO
yesterday












you are welcome! :)
– Ferdinando
yesterday




you are welcome! :)
– Ferdinando
yesterday

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53228275%2fconditional-checkbox-options-in-excel-form%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53228275%2fconditional-checkbox-options-in-excel-form%23new-answer', 'question_page');

);

Post as a guest














































































Popular posts from this blog

Kleinkühnau

Makov (Slowakei)

Deutsches Schauspielhaus