+ -
当前位置:首页 → 问答吧 → VBA关闭Word样式自动更新

VBA关闭Word样式自动更新

时间:2008-09-10

来源:互联网

Sub niuniu()
Dim updates As styles
Set updates = ActiveDocument.styles
If updates.InUse = True Then
updates.AutomaticallyUpdate = False
End If
End Sub

作者: robin521   发布时间: 2008-09-10

QUOTE:
以下是引用robin521在2008-9-10 16:03:00的发言:

Sub niuniu()
Dim updates As styles
Set updates = ActiveDocument.styles
If updates.InUse = True Then
updates.AutomaticallyUpdate = False
End If
End Sub

欢迎robin521!

Sub niuniu()
    Dim styleLoop As Style
    For Each styleLoop In ActiveDocument.Styles
        If styleLoop.Type = wdStyleTypeParagraph Then
            If styleLoop.InUse = True Then styleLoop.AutomaticallyUpdate = False
        End If
    Next styleLoop
End Sub
谢谢sylun兄的提醒,否则,我以为楼主是个分享贴,希以后注意。

InUse属性和AutomaticallyUpdate 属性均用于Style对象而非styles对象,另外,AutomaticallyUpdate属性在作用于字符样式时,可能出错。

[此贴子已经被作者于2008-9-10 17:56:02编辑过]

作者: 守柔   发布时间: 2008-09-10

楼主的好像是求助帖,老大可能没有细看。

试做了一下,不知是否规范,请老大赐教:
Sub test()
Dim oStyle As Style
For Each oStyle In ActiveDocument.Styles
    With oStyle
        If .InUse = True And .Type = wdStyleTypeParagraph Then
            If .AutomaticallyUpdate = True Then .AutomaticallyUpdate = False
        End If
    End With
Next
End Sub

作者: sylun   发布时间: 2008-09-10

QUOTE:
以下是引用sylun在2008-9-10 17:42:00的发言:

楼主的好像是求助帖,老大可能没有细看。

试做了一下,不知是否规范,请老大赐教:
Sub test()
Dim oStyle As Style
For Each oStyle In ActiveDocument.Styles
    With oStyle
        If .InUse = True And .Type = wdStyleTypeParagraph Then
            If .AutomaticallyUpdate = True Then .AutomaticallyUpdate = False
        End If
    End With
Next
End Sub

谢谢sylun兄。

代码基本上大同小异,区别不大。

作者: 守柔   发布时间: 2008-09-10

很感谢老大的代码,确实很有用,我又修改了一下,加了一些功能,再次感谢.

作者: robin521   发布时间: 2008-09-11

关闭excel的自动更新要怎么写

作者: almes   发布时间: 2011-02-15