Excel VBA TextBox控件的滚动条不能刷新
2024-10-14 08:04:59
问题:Excel中Textbox控件以及Form里的Textbox控件,当直接填充的内容很长时,滚动条不能实时刷新。
现象:
修改后:
原因:
虽然已经向Textbox的Text里设置了内容,但此时Textbox并没有被激活,焦点也没有变化,所以,Textbox的滚动条没有被刷新出来。
修改后的VBA程序:
-----------------------ActiveX Textbox--------------------------
Private Sub CommandButton1_Click() TextBox1.Value = "safdasfgsdfgfhfgjhfjfghjfhjfg" _
& Chr() _
& "" _
& Chr() ' IF the text length is long enough, ENABLE the Textbox's scroll bar
TextBox1.Activate
' Set the current select line: 0
TextBox1.CurLine = End Sub
-----------------------Form Textbox--------------------------
Private Sub CommandButton1_Click() TextBox1.Value = "safdasfgsdfgfhfgjhfjfghjfhjfg" _
& Chr() _
& "" _
& Chr() ' IF the text length is long enough, ENABLE the Textbox's scroll bar
TextBox1.SetFocus
' Set the current select line: 0
TextBox1.SelStart = End Sub
知识点:
ActiveX Textbox中的 TextBox1.Activate 和 Form Textbox的 TextBox1.SetFocus功能相同
最新文章
- nginx设置不使用缓存 add_header Cache-Control no-cache
- 【转】Java HashMap 源码解析(好文章)
- Django中如何使用django-celery完成异步任务1(转)
- 【Linux C中文函数手册】之 目录操作函数
- LeetCode Letter Combinations of a Phone Number 电话号码组合
- PHP获取函数返回值的引用
- expected function body after function declarator
- XML IList<;T>; TO DataSet TO DataTable 相互转换
- OPENCV基本滤波算法
- 线上Django项目python2到3升级日记
- java游戏开发杂谈 - java是什么
- vue打包速度优化
- PyCon大会Python主题演讲摘要
- linux下面发布80端口的服务
- 2018-2019-20172329 《Java软件结构与数据结构》第三周学习总结
- 转载-好用的linux软件合集
- Android 面试收集录5 消息机制
- EAR、JAR、WAR(IT)
- scikit-learn(project中用的相对较多的模型介绍):1.14. Semi-Supervised
- 我在B站学习 清华大学教授带你学习c++(进阶)构造函数
热门文章
- BZOJ 2115: [Wc2011] Xor [高斯消元XOR 线性基 图]
- controller 单元测试
- Django搭建博客网站(四)
- Redis 实践1- redis介绍和安装
- Python报错:IndentationError: expected an indented block
- ch11 持有对象
- Egret学习笔记.1 (写在前面的废话)
- ubuntu网络设置及遇到问题
- C# 枚举特性 FlagAttribute 的应用
- 笔记︱图像语义分割(FCN、CRF、MRF)、论文延伸(Pixel Objectness、)