vba - Word Macro to determine whether document contains highlighting -


i'm trying write macro displays popup when user clicks save (i have sub filesave() ) if document contains highlighting. far, works great message box. unfortunately can't figure out conditions use if statement check whether document contains highlighting or not.

can me few lines of vba this?

you need search highlighted text within document content in way:

sub searchanyhighlight()  dim hilirng range set hilirng = activedocument.content  hilirng.find     .highlight = true     .execute end  if hilirng.find.found     'to inform found     msgbox "you can't close active document"     'to remove highlighted area <-- added after edition     hilirng.find         .replacement.highlight = false         .execute "", replace:=wdreplaceall, forward:=true, _             replacewith:="", format:=true     end end if  end sub 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -