Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Aug 2001
    Location
    St. Louis, Missouri, USA
    Posts
    67
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Disabling macros causes read-only? ('97 SR2)

    Help!

    We do some preprocessing of files to clean them up before they go to an editor. And for that, we use a number of macros that do things like search for extra word spaces and delete them. I've also been playing with a trial version of a program called CrossEyes (for a reveal codes type of function). I've now uninstalled that.

    What I'd like to do is use the cleanup macros and then get rid of them so the editor doesn't even see them. I'm just not sure how to do that. When I close a document and then try to reopen it, I get the macro warning about viruses. If I click on "Disable macros," it becomes read-only and I can't save it, change the name, etc. I've gone to the organizer and deleted the macros, but it still acts like they're there.

    I've tried Help, but I'm lost in the "You can only find this if you already know just what Microsoft called it."

    I'm sure the ultimate problem will turn out to be, as usual, the nut behind the wheel. But please, somebody, save me from myself. <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15>

    Lin

  2. #2
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts

    Re: Disabling macros causes read-only? ('97 SR2)

    Once you've put a macro into a document or template, Word brands it with a <font color=red>Scarlet M</font color=red>. Even if you completely remove the macro and all macro modules, the brand sticks.

    The easiest thing to do is create a new document based on the same template. Use the organizer to copy all styles from your branded document three times (copy all styles once, then copy them again, then copy them a third time).

    Then in your branded document go select all, copy, and paste into your new document. You may have to individually copy some headers and footers as well.

    Making sure that "update styles" is unchecked, use Tools => Templates and Add-ins to attach your normal.dot template to the new document.

    Close and save the branded document. Rename it to a different name. Close and save your new document, using the old name.

    Next time, you might want to put the macros in a global template. That way they can be used for your cleanup, etc., without branding the doc. See <A target="_blank" HREF=http://addbalance.com/usersguide/templates.htm> Template Basics</A> for more about such templates.

    Hope this helps.
    Charles Kyle Kenyon
    Madison, Wisconsin

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Disabling macros causes read-only? ('97 SR2)

    You can use this macro to "clone" your tainted doc to a clean one:

    <pre>Sub CloneMe()
    'Duplicate the current document as a new document (without the historical trail)
    '2001-06-09 Jefferson Scher
    If Documents.Count < 1 Then 'there are no open docs
    MsgBox "Open a document and then try this again."
    Exit Sub
    End If

    If MsgBox("Clone the current document as a new document?", vbQuestion + vbYesNo) _
    <> vbYes Then Exit Sub

    If ActiveDocument.Saved = False Then
    If MsgBox("Save changes first?", vbQuestion + vbYesNo) = vbYes Then
    ActiveDocument.Save
    End If
    End If

    Dim newDoc1 As Document, strTempTempPath As String, newDoc2 As Document
    'create template from current document, save and close it, terminate the object
    Set newDoc1 = Documents.Add(Template:=ActiveDocument.FullName, newtemplate:=True)
    strTempTempPath = "c:jfstemptemplate.dot"
    newDoc1.SaveAs FileName:=strTempTempPath
    newDoc1.Close
    Set newDoc1 = Nothing
    'create new document from temporary template, change it to normal template
    Set newDoc2 = Documents.Add(Template:=strTempTempPath, newtemplate:=False)
    newDoc2.AttachedTemplate = NormalTemplate.FullName
    'delete the temporary template ? this file is "in use" for some reason
    'Kill strTempTempPath
    'bring the new document to the fore and terminate its object
    newDoc2.Activate
    Set newDoc2 = Nothing
    'remind user that s/he is looking at the clone, not the original
    MsgBox "Your clone is ready."
    End Sub</pre>

    This was developed and tested in Word2000.

  4. #4
    Star Lounger
    Join Date
    Aug 2001
    Location
    St. Louis, Missouri, USA
    Posts
    67
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Disabling macros causes read-only? ('97 SR2)

    Thank you both.

    Jefferson, your fix works beautifully and will save my sanity--at least till something else makes me lose it. <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

    Charles, I'm still reading and rereading the info about how to use global templates. I think it's beginning to soak in . . <img src=/S/snail.gif border=0 alt=snail width=21 height=17>

    Lin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •