对接上一自用模板,为功能有切换页面护眼绿()、切换页面视图、模拟快捷键点击,可以为其添加快捷键
Sub 切换页面护眼绿()
If (ActiveDocument.Background.Fill.ForeColor.ObjectThemeColor = _
wdThemeColorAccent6) Then
ActiveDocument.Background.Fill.ForeColor.ObjectThemeColor = _
wdThemeColorBackground1
ActiveDocument.Background.Fill.ForeColor.TintAndShade = 0#
ActiveDocument.Background.Fill.Visible = msoTrue
ActiveDocument.Background.Fill.Solid
Else
ActiveDocument.Background.Fill.ForeColor.ObjectThemeColor = _
wdThemeColorAccent6
ActiveDocument.Background.Fill.ForeColor.TintAndShade = 0.8
ActiveDocument.Background.Fill.Visible = msoTrue
ActiveDocument.Background.Fill.Solid
End If
End Sub
折腾了好久,试了好多好多遍才找到适合WPS的方案
那个RGB颜色不是真的RGB,得去word哪里边录制宏边调字体背景颜色才弄找得到自己想要的颜色.
但是呢,得手动变化一次背景太麻烦了
Sub 护眼绿切换()
'
' Macro1 Macro
' 宏由 lalal 录制,时间: 2023/02/19
If (ActiveDocument.Background.Fill.ForeColor.RGB = _
wdColorWhite) Then
ActiveDocument.Background.Fill.ForeColor.RGB = 14149338
Else
ActiveDocument.Background.Fill.ForeColor.RGB = wdColorWhite
End If
End Sub
经常要并排查看word,而放大后有经常是显示不全,web视图就很好解决问题,设置快捷键即可一键切换
Sub web视图切换()
'
If (ActiveWindow.ActivePane.View.Type = wdPrintView) Then
ActiveWindow.ActivePane.View.Type = wdWebView
Else
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
End Sub
模拟点击,因为个人习惯设置F4是阅读文字
Sub 按键F4()
//模拟键盘点击F4
Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "{F4}"
End Sub
;但WPS只能触发一次,在wps用vba真的太难受了
Sub 组合键打开段落设置()
'
Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "%{h}{k}{down 6}{enter}"
End Sub