1. vbs调用excel点击鼠标
Set dw = CreateObject("DynamicWrapper") dw.Register "user32.DLL", "SetCursorPos","i=ll","f=s","r=l" a=dw.SetCursorPos (100,500) 说明:以上代码保存为.vbs文件 设定鼠标位置为(100,500) 评论:这个控件有很多的API函数还是无法使用,例如:无法获取鼠标的坐标(也许是我不会,但是至今没看到这样的代码)
2. vba鼠标点击单元格获取内容
用编程,也就是VBA了,因为VBA中有鼠标事件,click,doubleclick等引发了你想要的结果
3. vba鼠标点击
移动光标至文档开始Selection.HomeKey unit:=wdStory下面的供参考:Sub MoveToCurrentLineStart()'移动光标至当前行首Selection.HomeKey unit:=wdLineEnd SubSub MoveToCurrentLineEnd()'移动光标至当前行尾Selection.EndKey unit:=wdLineEnd SubSub SelectToCurrentLineStart()'选择从光标至当前行首的内容Selection.HomeKey unit:=wdLine, Extend:=wdExtendEnd SubSub SelectToCurrentLineEnd()'选择从光标至当前行尾的内容Selection.EndKey unit:=wdLine, Extend:=wdExtendEnd SubSub SelectCurrentLine()'选择当前行Selection.HomeKey unit:=wdLineSelection.EndKey unit:=wdLine, Extend:=wdExtendEnd SubSub MoveToDocStart()'移动光标至文档开始Selection.HomeKey unit:=wdStoryEnd SubSub MoveToDocEnd()'移动光标至文档结尾Selection.EndKey unit:=wdStoryEnd SubSub SelectToDocStart()'选择从光标至文档开始的内容Selection.HomeKey unit:=wdStory, Extend:=wdExtendEnd SubSub SelectToDocEnd()'选择从光标至文档结尾的内容Selection.EndKey unit:=wdStory, Extend:=wdExtendEnd SubSub SelectDocAll()'选择文档全部内容(从WholeStory可猜出Story应是当前文档的意思)Selection.WholeStoryEnd SubSub MoveToCurrentParagraphStart()'移动光标至当前段落的开始Selection.MoveUp unit:=wdParagraphEnd SubSub MoveToCurrentParagraphEnd()'移动光标至当前段落的结尾Selection.MoveDown unit:=wdParagraphEnd SubSub SelectToCurrentParagraphStart()'选择从光标至当前段落开始的内容Selection.MoveUp unit:=wdParagraph, Extend:=wdExtendEnd SubSub SelectToCurrentParagraphEnd()'选择从光标至当前段落结尾的内容Selection.MoveDown unit:=wdParagraph, Extend:=wdExtendEnd SubSub SelectCurrentParagraph()'选择光标所在段落的内容Selection.MoveUp unit:=wdParagraphSelection.MoveDown unit:=wdParagraph, Extend:=wdExtendEnd SubSub DisplaySelectionStartAndEnd()'显示选择区的开始与结束的位置,注意:文档第1个字符的位置是0MsgBox ("第" & Selection.Start & "个字符至第" & Selection.End & "个字符")End SubSub DeleteCurrentLine()'删除当前行Selection.HomeKey unit:=wdLineSelection.EndKey unit:=wdLine, Extend:=wdExtendSelection.DeleteEnd SubSub DeleteCurrentParagraph()'删除当前段落Selection.MoveUp unit:=wdParagraphSelection.MoveDown unit:=wdParagraph, Extend:=wdExtendSelection.DeleteEnd Sub
4. vba 控制鼠标 点击
1、打开一个Excel文件,鼠标右击下面的工作表(如sheet1)。选择“查看代码”,就可以打开VBA编辑界面;
2、选择搜索框的下拉菜单,选择“worksheet”选项功能;
3、选择BeforeDoubleClick,也就是在本工作表鼠标双击(之前),将触发下面的代码程序;
4、选择完成后,这样会看到下面出现了两条代码;这俩条代码其实是在声明一个函数;
5、将鼠标放置在这两行代码之间,这时写上执行语句:Sheet1.Cells(1, 3) = Sheet1.Cells(1, 1) + Sheet1.Cells(1, 2);
6、然后点击保存,回到Excel的原始界面。在cells(1,1)和cells(1,2)中输入两个数值;
7、在sheet1的工作表中,双击鼠标会发现,cells(1,3)的值变成了cells(1,1)和cells(1,2)的和。
5. vb 鼠标点击
你应该调用API Declare Auto Function FindWindow Lib "USER32.DLL" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr Declare Auto Function SetForegroundWindow Lib "USER32.DLL" (ByVal hWnd As IntPtr) As Boolean然后把鼠标移动上去
- 相关评论
- 我要评论
-