msgbox

Deactivate msgbox in a sub VBA

爷,独闯天下 提交于 2021-02-19 07:47:27
问题 Sub prelim() MsgboX "Hello World" End Sub Sub Main() Call prelim End Sub In the above code Sub prelim can't be edited.I want msgbox when I run Sub prelim but when I run Sub Main I don't want the message box to get popped out. How to do it? 回答1: This is not possible without changing Sub prelim Sub prelim(Optional silent As Boolean = True) If Not silent Then MsgBox "Hello World" End Sub Sub Main() prelim True 'no msgbox prelim False 'with msgbox prelim 'no msgbx End Sub 来源: https:/

Excel VBA入门(8): 代码调试/错误处理/代码优化

爱⌒轻易说出口 提交于 2021-02-15 04:20:15
VBE有丰富的调试工具, 比如立即窗口, 本地窗口, 监视窗口, 断点调试... 第一个博文中已经讲过调试的基本操作: 设置断点, F5运行, F8逐条运行 断点就是程序中暂停停止运行的位置, 设置断点之后, 当运行到断点行所在的语句程序就进入中断模式, 此时在本地窗口和立即窗口中 可以查看变量以及对象的属性值. 1. debug 介绍: 调试工具的基石 debug.print x 在不中断程序的情况下输出x 的值 debug.assert 与if 类似, 用与判断一个条件是否成立, 但是if 语句不会暂定程序的执行, 如果assert方法的参数不成立, 程序会暂停进入中断模式. Function assert_test(x As Integer , y As Integer ) As Double Debug.Assert y <> 0 ' y=0则进入中断模式 If y <> 0 Then assert_test = x / y End If End Function Sub test() MsgBox assert_test( 10 , 2 ) ' 正常运行 MsgBox assert_test( 10 , 0 ) ' 在Debug.Assert y <> 0 程序会中断 End Sub 立即窗口的使用 : 立即窗口的输出如果超过200行, 就只显示最后200行的内容

VBA中引用工作表函数

爱⌒轻易说出口 提交于 2021-02-11 20:43:09
在Excel里有很多函数使用起来很方便,譬如:sum、average、min、max。 但是工作表函数是不能在宏代码里直接使用的,它们和vba语言中的函数是不一样的;与之相对应,Vba中的函数例如val,mid在工作表里也不能通用。 所以在vba语言里调用工作表函数,例如: 1. 让一个变量得到单元格A1到B5的总和(变量设为X) X=SUM(RANGE("A1:B5"))的写法明显是行不通的。 2. 正确写法是: 1 Sub 引用工作表函数() 2 Dim x% 3 x = Application.WorksheetFunction.Sum(Range( " A1:B5 " )) 4 End Sub 也就是说必须通过 Application 对象的 Worksheetfunction 属性来间接调用工作表函数! 以下三种方法都对: 1 ' 借用工作表函数 2 Sub 运用工作表函数() 3 MsgBox Application.WorksheetFunction.CountIf(range( " a1:a10 " ), " 钢笔 " ) 4 MsgBox WorksheetFunction.CountIf(range( " a1:a10 " ), " 钢笔 " ) 5 MsgBox Application.CountIf(range( " a1:a10 " ), " 钢笔 " )

MsgBox caused charts to appear as blank

旧街凉风 提交于 2021-02-11 14:15:09
问题 I have created code to fit a model to some data and then create a chart comparing measured/fitted data. I want to include a msgbox so that the user can check that the chart shows a decent fit and then OK it to continue. Even though the code for the msgbox is after the creation of the charts (right at the end of the sub), the charts are displayed as blank while the msgbox is shown. The charts display properly after either yes or no is selected in the msgbox. I have tried, pausing the sub for a

MsgBox argument 'vbMsgBoxSetForeground' has no function

寵の児 提交于 2021-02-05 12:28:25
问题 According to the documentation about the MsgBox argument vbMsgBoxSetForeground : "The message box window becomes the foreground window." In Windows 10 I've the problem (in Windows 7 & XP I didn't have this problem) that some message boxes (VBScript called from a minimized batch file) are not visible because they are covered by other open windows. That's why I wanted to add the argument vbMsgBoxSetForeground to my message boxes: Call MsgBox("Test Message", vbMsgBoxSetForeground) . But

MsgBox argument 'vbMsgBoxSetForeground' has no function

隐身守侯 提交于 2021-02-05 12:26:32
问题 According to the documentation about the MsgBox argument vbMsgBoxSetForeground : "The message box window becomes the foreground window." In Windows 10 I've the problem (in Windows 7 & XP I didn't have this problem) that some message boxes (VBScript called from a minimized batch file) are not visible because they are covered by other open windows. That's why I wanted to add the argument vbMsgBoxSetForeground to my message boxes: Call MsgBox("Test Message", vbMsgBoxSetForeground) . But

visualfreebasic 5正式版(可视化编程环境)

断了今生、忘了曾经 提交于 2021-02-04 17:27:41
visualfreebasic 5 是基于FreeBasic编程语言开发的一款IDE工具,集成了IDE、编译器、帮助、函数库等,且承担了非常繁琐的核心操作,让用户只注重应用层面开发,轻轻松松进行编程,其他的都不需要操心,不管你是新手还是高手,在这里都能发挥你极致的编程水平。该软件拥有和VB6高度相似的语法规则,C语言的强大底层,你可任意调用C语言标准函数,并支持可视化工程编程和纯代码工程编程,这对于资深高手来说,是个不错的选择,而且visualfreebasic还提供一整套的代码提示、自动补全及代码说明提示,绝对能够满足新手和资深编程爱好者快速、高效、高质量编写各种类型应用软件的需求。最重要的是,它永久免费,无任何限制、植入、广告,也无需安装,部署环境以及任何运行库,解压后即可直接使用,下文奉上了详细的编程入门教程。欢迎有需要的小伙伴们前来下载体验。 主要功能 -可视化编辑窗口和控件,提供各种控件使用。 -组织窗口和控件生成代码,包括事件处理。 -让FreeBasic支持中文函数名称、中文变量名和中文的控件名称。 -提供一整套的代码提示、自动补全及代码说明提示 -自动组织资源文件,图标、图像、任意文件可以加入资源中。 -内嵌帮助、库 等 visualfreebasic编程入门教程 1、在本站下载解压,得到visualfreebasic 5正式版软件包; 2、双击运行

PHP websocket之聊天室实现

China☆狼群 提交于 2021-01-31 05:33:53
<p>PHP部分</p> ``` <?php error_reporting(E_ALL); set_time_limit(0);// 设置超时时间为无限,防止超时 date_default_timezone_set('Asia/shanghai'); class WebSocket { const LOG_PATH = '/tmp/'; const LISTEN_SOCKET_NUM = 9; /** * @var array $sockets * [ * (int)$socket => [ * info * ] * ] * todo 解释socket与file号对应 */ private $sockets = []; private $master; public function __construct($host, $port) { try { $this->master = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); // 设置IP和端口重用,在重启服务器后能重新使用此端口; socket_set_option($this->master, SOL_SOCKET, SO_REUSEADDR, 1); // 将IP和端口绑定在服务器socket上; socket_bind($this->master, $host, $port

VBA MsgBox Limitations - output more than 1024 characters

给你一囗甜甜゛ 提交于 2021-01-28 06:38:59
问题 I want to display long message in MsgBox (more then 1024 characters). What method can i use. I found this: Dim objShell As Object Set objShell = CreateObject("Wscript.Shell") Can You tell me are there any methods to achieve this? Maybe someone know better solution or disadvantages of using Wscript.Shell?? Oh, and one more thing, I want to add this code to an add-in i've created and which I want to distribute to othet coworkers.. 回答1: So create a Form that looks like a MsgBox: I used a TextBox

爱看小说的有福了......

落爺英雄遲暮 提交于 2021-01-27 06:40:50
利用Python3 编写爬虫,从笔趣阁爬小说,可以下载到手机看。 运行截图: 程序实现如下: ---有点小bug,不过无所谓了。。。 import re import urllib.request import time import easygui as g # 输入地址 g.msgbox( " " ) msg = "输入小说地址,例如http://www.biquge.com.tw/0_213/" title = '爬虫' root = g.enterbox(msg , title) # 伪造浏览器 headers = { 'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) ' \ 'AppleWebKit/537.36 (KHTML, like Gecko)' \ ' Chrome/62.0.3202.62 Safari/537.36' } req = urllib.request.Request( url =root , headers =headers) with urllib.request.urlopen(req , timeout = 1 ) as response: # 大部分的涉及小说的网页都有charset='gbk',所以使用gbk编码 htmls = response.read().decode