| 网站首页 | 模板 | 资料 | 源码 | 工具 | 开发 | 设计 | 安全 | 项目 | 网络 | 图片 | 系统 | 数据库 | 博客 | 会员中心 | 小说 | 
MYFTP 精品资料下载
网络学院
学习资料
源码模版
您现在的位置: 精品下载 >> 开发 >> .net >> 文章正文 用户登录 新用户注册
从Excel 单元格定位到Word 文档中指定的位置带来的思考            【字体:
从Excel 单元格定位到Word 文档中指定的位置带来的思考
作者:佚名    文章来源:不详    点击数:    更新时间:2007-10-7

'以下VBA脚本实现标题阐述功能,考虑以下问题:

  1. 如何捕获一个Cell单元格的单击事件?
  2. Excel 中能否添加处理其他的Windows 消息?

'Unit   :   mcc
'Fun    :   Goto exactly position in Word from Excel impls by VBA.
'args   :   Bookmark string(predefined in Word handed yourself or using tools)
'ref    :   Ms Word/Excel object lib.
'modify :   1.open word archives in readonly way 2.get abs path using for anchor
'future :   1.search by string exactly
'Author :   qjwxsd
'DT     :   2005-04-18~~

Const TC3 = "TC03_軟体版權管理/TC03_Software license management"
Const TC4 = "TC04_配備資源管理/TC04_Periphery resource"
Const TC10 = "TC10_資料安全管理/TC10_Data security management"

Public Sub gotoWord(FileName, Bookmark As String)
    On Error Resume Next
    Dim a As Word.Application
    Dim b As Word.Document
   
    Dim c As Excel.Application
    Dim d As Excel.Workbook
    Dim e As Excel.Worksheet

    Dim path As String
   
    Set c = GetObject(, "Excel.Application")
    Set d = c.ActiveWorkbook
    Set e = d.ActiveSheet
    'path = c.path
    path = d.path
    '取得当前功能清单的路径,传到Word中。否则Word无法取得路径,
    '打开相应的TC。
    Set a = GetObject(, "Word.Application")
    If a = Null Then
        Set a = CreateObject("Word.Application")
    End If
   
    'a.Documents.Open "H:/0408/PCmain5.5.0 _Other.doc"
    'MsgBox a.Path
    'MsgBox Application.Path
    'MsgBox CurDir
    'MsgBox a.Documents.Item(0).FullName
   
    a.Documents.Open path & "/" & FileName & ".doc", ReadOnly:=True
    a.Selection.GoTo what:=wdGoToBookmark, Name:=Bookmark
    a.Visible = True
    a.Activate '前台显示Word窗体
End Sub

Private Sub Label1_Click()
    gotoWord TC3, "TC3_1"
End Sub

Private Sub Label10_Click()
    gotoWord TC4, "TC4_4"
End Sub




文章录入:chqnet    责任编辑:chqnet 
  • 上一篇文章:

  • 下一篇文章:
  • 最新热点 最新推荐 相关文章
    用tabIndex轻松实现网页导航
    expression将JS、Css结合起来
    CSS中的行为——expression
    CSS中expression使用简介
    巧用expression区分只读文本
    利用css里expression来实现界
    网页的textarea自动适应高度
    文字布局(TEXT STYLE)标记
    CSS文本:text-autospace
    CSS文本:text-kashida-spac
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)