Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2008

Tip: Looking for answers? Try searching our database.

disable macros in word

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Associates - 21 Feb 2008 22:47 GMT
Hi,

I would like to be able to write codes to disable macros in VBA for office
word 03 document.

I wonder if anyone might be able to guide me on how to do this?

Thank you in advance
Graham Mayor - 22 Feb 2008 07:17 GMT
If you save macros in a document then a user can re-enable them. The only
solution is to remove them. You can do this with the macro organizer, or you
could save as RTF which does not support macros eg

Dim sFname As String
With ActiveDocument
   If .Path = "" Then
       .Save
   End If
   sFname = .FullName
   sFname = Left(sFname, Len(sFname) - 3)
   MsgBox sFname
   .SaveAs FileName:=sFname & "RTF", _
       FileFormat:=wdFormatRTF
   .Close
End With
Documents.Open FileName:=sFname & "RTF"
ActiveDocument.SaveAs sFname & "doc", _
       FileFormat:=wdFormatDocument

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Hi,
>
[quoted text clipped - 4 lines]
>
> Thank you in advance
Graham Mayor - 22 Feb 2008 07:23 GMT
On reflection it might be better to change

  If .Path = "" Then
       .Save
   End If

to simply
   .Save

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Hi,
>
[quoted text clipped - 4 lines]
>
> Thank you in advance
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.