Results 1 to 9 of 9
  1. #1
    Star Lounger
    Join Date
    Jan 2001
    Location
    Los Angeles
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    save as text file warning (2000)

    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!

  2. #2
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: save as text file warning (2000)

    I'm assuming the warning relates to losing formatting, layout etc. I don't know if there's a way to turn it off, but in case you're not aware, you'll end up with a "document" containing only plain text if you do save it as .TXT.

    Alan

  3. #3
    Star Lounger
    Join Date
    Jan 2001
    Location
    Los Angeles
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: 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!

  4. #4
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: save as text file warning (2000)

    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.
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  5. #5
    Super Moderator
    Join Date
    Dec 2000
    Location
    Renton, Washington, USA
    Posts
    12,560
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Re: save as text file warning (2000)

    "(A user has to do this about 100 times a day, that's why I'm trying to speed up the process). "

    Why NOT get a GOOD Text Editor to do this work, and NOT use MS Word.

    Now running HP Pavilion a6528p, with Win7 64 Bit OS.

  6. #6
    Star Lounger
    Join Date
    Jan 2001
    Location
    Los Angeles
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: save as text file warning (2000)

    The files come in from outside the firm in Word format, but then move to another system that doesn't support Word documents.

  7. #7
    Star Lounger
    Join Date
    Jan 2001
    Location
    Los Angeles
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: save as text file warning (2000)

    Bryan
    This helps part of the problem. I was hoping I could actually see the results of the conversion on the screen after the save as text.
    thanks,
    David

  8. #8
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: save as text file warning (2000)

    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

  9. #9
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: save as text file warning (2000)

    <P ID="edit" class=small>(Edited by carbonnb on 08-Mar-03 10:54. Forgot to add one important point)</P>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.
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

Posting Permissions

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