Each time I save a doc as a text file, Word gives a warning about converting. Is there any way to turn this off? (I see the option to turn on or off warning on OPEN for conversion.)
THANKS!
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » save as text file warning (2000)
I am aware of losing formatting – that’s why we are saving as text. (A user has to do this about 100 times a day, that’s why I’m trying to speed up the process). I’ve written a simple macro that saves the document as a txt file. It’s working fine, except the document on the screen doesn’t show up as a text file (with “plain” as the style and no formatting) unless I close and then open the file. (So it’s doing its job, it just doesn’t display the results with the active doc.) Is there a convert command that would convert the document on the screen? Or should I close the current document and reopen it? I’m not sure how I could close and then open the same document.
Here’s what I have so far:
Sub SaveAsTxt()
‘On Error GoTo EndSaveAsTxt
If ActiveDocument.SaveFormat = 2 Then
ActiveDocument.Save
Else
With Application.Dialogs(wdDialogFileSaveAs)
.Format = wdFormatText
.Show
End With
End If
Endsaving:
End Sub
THANKS ALL!
If you put Application.Display Alerts = wdAlertsMessageBox before and Application.DisplayAlerts = wdAlertsAll after your save code, this will “hide” the lose format dialog box.
Here is the revised Else code:
Application.DisplayAlerts = wdAlertsMessageBox
With Application.Dialogs(wdDialogFileSaveAs)
.Format = wdFormatText
.Show
End With
Application.DisplayAlerts = wdAlertsAll
This will still show the Overwrite dialog if the file already exists, but won’t show the “lose formatting” dialog.
How about creating a style that looks the way you want, maybe using courier new at a suitable point size, and then applying that style to all text in the document and clearing any manual formatting.
Something lilke…
ActiveDocument.Content.Style = “TextStyle”
ActiveDocument.Content.ParagraphFormat.Reset
ActiveDocument.Content.Font.Reset
StuartR
(Edited by carbonnb on 08-Mar-03 10:54. Forgot to add one important point)
I think that you need to close and then reopen the file to see the results of the conversion.
So to do that you need to get the filename after the file has been saved, close the document and then reopen
Sub SaveAsTxt()
‘On Error GoTo EndSaveAsTxt
Dim strFile As String
If ActiveDocument.SaveFormat = 2 Then
ActiveDocument.Save
Else
Application.DisplayAlerts = wdAlertsMessageBox
With Application.Dialogs(wdDialogFileSaveAs)
.Format = wdFormatText
.Show
strFile = .Name
End With
Application.DisplayAlerts = wdAlertsAll
End If
ActiveDocument.Close
Documents.Open strFile
Endsaving:
End Sub
Important point: You should have this code in a global template. If it is in the document that you are saving as plain text, then once the document closes, the code stops running, so it won’t re-open automatically.
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.