周一至周五 : 08:30 - 17:30 客服专员电话/微信:17301649371 QQ:2627049059
微信咨询

扫码微信咨询

关注公众号

关注微信公众号

电话: 021 5161 9370
返回顶部
VBA打开本地记事本计算器远程桌面等
显示全部楼层 倒序浏览 发表日期 2022-11-23 18:02:59 702次阅读 0次回复
admin
2022-11-23 18:02:59

VBA打开本地记事本计算器远程桌面等



20221123180224.png

  1. Imports SpreadsheetGear
  2. Imports C1.Silverlight
  3. Imports C1.Silverlight.C1MessageBoxButton
  4. Imports C1.Silverlight.C1MessageBoxIcon
  5. Imports Newtonsoft.Json
  6. Imports Newtonsoft.Json.Linq
  7. Imports System.Windows.forms
  8. Imports System.Runtime.InteropServices.Automation
  9. Namespace ExcelViewVBDotnet
  10.    Public Class StandardInterface
  11.        '预留位置1
  12.        '预留位置2
  13.        Dim EV As SpreadsheetGear.Windows.Controls.WorkbookView,AW As SpreadsheetGear.IWorkbook,Range As SpreadsheetGear.IRange
  14.        Public Sub Workbook_Open(OldRoot As Object,NewRoot As Object,Excel As SpreadsheetGear.Windows.Controls.WorkbookView)
  15.            EV = Excel
  16.            Excel.GetLock()
  17.            AW = Excel.ActiveWorkbook
  18.            Range = AW.ActiveWorksheet.Range
  19.            Excel.ReleaseLock()
  20.        End Sub'打开时执行事件

  21.        Public Sub RangeSelection(sender As Object,e As SpreadsheetGear.Windows.Controls.RangeSelectionChangedEventArgs)

  22.        End Sub'单元格选择后执行的事件

  23.        Public Sub RangeChanged(sender As Object,e As SpreadsheetGear.Windows.Controls.RangeChangedEventArgs)

  24.        End Sub'单元格编辑完成后执行事件

  25.        Public Sub ButtunClick(sender As Object,e As SpreadsheetGear.Windows.Controls.ShapeActionEventArgs)
  26. Dim Shell As Object = AutomationFactory.CreateObject("Shell.Application")
  27.             If e.Shape.Name = "Button 1" Then
  28.                 Shell.ShellExecute("C:/Windows/notepad.exe")
  29.             ElseIf e.Shape.Name = "Button 2" Then
  30.                 Shell.ShellExecute("C:/Windows/regedit.exe")
  31.             ElseIf e.Shape.Name = "Button 3" Then
  32.                 Shell.ShellExecute("C:/WINDOWS/system32/calc.exe")
  33.             ElseIf e.Shape.Name = "Button 4" Then
  34.                 Shell.ShellExecute("C:/WINDOWS/system32/mstsc.exe")
  35.             End If
  36.        End Sub'按钮/标签点击事件

  37.        Public Sub FollowHyperlink(sender As Object)

  38.        End Sub '暂不支持

  39.    End Class
  40. '  注:除事件字眼下可以自定义代码外的所有代码不允许改动,否则编译将有可能失败。
  41. End Namespace
复制代码













您需要登录后才可以回帖 登录 | 立即注册

本版积分规则  允许回帖邮件提醒楼主

快表软件是国内较早研究表格类软件开发平台的团队之一,迄今已有十多年的行业经验.致力于为企事业单位提供实用可靠的数字化平台。
  • 微信公众号

  • 微信小商店

  • 微信客服

  • Powered by Discuz! X3.4 | Copyright © 2022-2024, XiRong Soft. | 快表软件
  • 沪ICP备13033196号 | 营业执照 |上海西戎软件科技有限公司|沪公网安备31011502002146号|沪ICP备13033196号 |