清除复选框的代码 [英] Code for clearing checkboxes

查看:120
本文介绍了清除复选框的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在尝试为Excel中的复选框创建代码。我希望在单击复选框(表单控件。或者它是否需要为activeX?)时激活代码,显示一个消息框,询问他们是否要将此实际标记为优先级。如果是,它将通过电子邮件发送
。如果不是,则创建pdf并将电子邮件发送到某个电子邮件。我已经创造了大部分。

Hello, I trying to create a code for a checkbox in Excel. I want the code to activate upon clicking the checkbox (form control. or does it need to be activeX?), display a message box asking if they want to actually mark this a priority. if yes, it will send out an email. if no, then a pdf is created and an email is sent to a certain email. I have the majority of this already created.

Public Sub Red_Msg_box()
Dim intResponse As Integer

intResponse = MsgBox("This will send an email to Product Quality.  Are you sure you want to mark it Priority Red?", _
 vbYesNo + vbQuestion + vbApplicationModal, _
 "Priority Red Build?")


If intResponse = vbYes Then
    ActiveSheet.Range("A1:I100").ExportAsFixedFormat Type:=xlTypePDF, _
        Filename:="\\RETUS537-NT0001.IKEA.COM\Common_A\537 Commercial Team Drive\Sales Plan and Steer\Product Quality\excel forms\build request.pdf", _
        OpenAfterPublish:=False
    Set olApp = CreateObject("Outlook.Application")

    Dim olMail As Outlook.MailItem
    Set olMail = olApp.CreateItem(olMailItem)
    
    olMail.To = "Quality Jax"
    olMail.Subject = "Build Request - Red"
    olMail.Body = "A Red priority item has been entered into the Build Request log. Please check the log for more information about the item. Thank you."
    olMail.Send
ElseIf msgValue = vbNo Then
   Clear.CheckBox
   
End If
End Sub

我的问题:我如何对其进行编码,以便在消息框中没有点击时取消选中此框?

My problem: how do I code it so that the box is unchecked when no is clicked on the message box?

谢谢

推荐答案

Joan,

re: 复选框设置



右键单击复选框,选择"格式控制"按钮并指定"链接单元"。到复选框。

例如说你分配了A51,那么你的代码可能是......



  ElseIf intResponse = vbNo然后是
   范围("A51")。值=假是
 结束如果

Joan,
re:  checkbox setting

Right click the checkbox, choose "Format Control" and assign a "link cell" to the checkbox.
For instance say you assigned A51, then your code could be...

  ElseIf intResponse = vbNo Then
    Range("A51").Value = False
 End If

"--- ---
Jim Cone

美国俄勒冈州波特兰市
https://goo.gl/IUQUN2  (Dropbox)
'---
Jim Cone
Portland, Oregon USA
https://goo.gl/IUQUN2 (Dropbox)


这篇关于清除复选框的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆