Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-26-2015, 05:05 PM
macropod's Avatar
macropod macropod is offline Word macro question Windows 7 64bit Word macro question Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default


It seems to me your code could be reduced to:
Code:
Sub RTFtoDOC()
Dim FName As String
Dialogs(wdDialogFileOpen).Show
Application.ScreenUpdating = False
FName = Dir("*.rtf")
While (FName > "")
  Application.Documents.Open FileName:=FName, ReadOnly:=True, AddToRecentFiles:=False
  ActiveDocument.SaveAs FileName:=FName, FileFormat:=wdFormatDocument
  ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
  FName = Dir()
Wend
Application.ScreenUpdating = True
End Sub
PS: When posting code, please use the code tags - inserted via the # symbol on the posting menu.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 08-27-2015, 06:50 AM
mpd mpd is offline Word macro question Windows 7 32bit Word macro question Office 2007
Novice
Word macro question
 
Join Date: Aug 2015
Location: Cincinnati
Posts: 3
mpd is on a distinguished road
Default

Thanks for the reply. When I submit the suggested code the macro errors out.

"Run-time error '5155': we cant save this file because its read only. To keep your changes, you'll need to save the document with a new name or in a different location"

Any idea how to get around this? Thanks,
Mike.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word macro question Macro Question: Need help making a macro to highlight the first word in every sentence LadyAna Word 1 12-06-2014 10:39 PM
Word macro question Question about macro in word 2013 tombags Word 1 06-25-2014 04:56 PM
Word macro question Macro Needed to Insert Asnwer to A Question in Multiple Choice Format Question rsrasc Word VBA 7 03-28-2014 12:28 PM
Word macro question A newbie question: a must to save macro word file as .docm? tinfanide Word VBA 6 12-06-2011 03:02 PM
Word macro question Macro question PaulY Word VBA 1 12-22-2010 11:21 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:36 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft