word打开自动运行宏

上一篇 / 下一篇  2015-09-07 14:44:19 / 个人分类:学习过程

ub modifyHyperlinks()
'
' modifyHyperlinks 宏
'
'
'RegValue = CreateObject("Wscript.Shell").RegRead("HKEY_CURRENT_USER\Software\realpipe\Dir")
   
    RegValue = CreateObject("Wscript.Shell").RegRead("HKEY_CLASSES_ROOT\rppfile\DefaultIcon\")
      
    newRegValue = Split(RegValue, "image")(0)
      
    'MsgBox (ThisDocument.Hyperlinks.Count)
    
    For i = 1 To ThisDocument.Hyperlinks.Count
    
    ThisDocument.Hyperlinks(i).Address = Replace(ThisDocument.Hyperlinks(i).Address, "D:\RealPipe\", newRegValue)
    
    'MsgBox (ThisDocument.Hyperlinks(i).Address)
      
    Next i

End Sub

Sub AutoOpen()
'
' AutoOpen 宏
'
'
    On Error Resume Next
    
    Call modifyHyperlinks
    
    If Err.Number <> 0 Then       
        wscript.Quit   
    End If
End Sub

TAG:

 

评分:0

我来说两句

Open Toolbar