Prev: Copy all hilighted words to a new document using VBA
Next: VBA to colour table cells and add values when a function key i
From: Kevin T. Kevin on 29 Dec 2009 09:47 Hello, Thanks for the forum. I am trying to save a document that has been created in word 2003. I believe it is initially a .RTF file and we want to then save it as a word 2000 .doc. Without going into much detail about why, we have noticed that the new 2003 files when converted from .RTF to .doc increase the size of the file muich more that 2000 did. One of our apps. do not like it. I really like the idea Graham provided for what I am trying to accomplish. However, I am not sure what I should change. I am guessing we need to make a change at the " wdFormatDocumentXX "? Regards, Kevin "Graham Mayor" wrote: > If Application.Version < 12 Then > ActiveDocument.SaveAs FileName:="filename.doc", wdFormatDocument > Else > ActiveDocument.SaveAs FileName:="filename.doc", wdFormatDocument97 > End If > > -- > <>>< ><<> ><<> <>>< ><<> <>>< <>><<> > Graham Mayor - Word MVP > > My web site www.gmayor.com > Word MVP web site http://word.mvps.org > <>>< ><<> ><<> <>>< ><<> <>>< <>><<> > > > > Mary Pytosky wrote: > > Hi, > > > > What would be the code/Fileformat to change the document to be saved > > as an Office 2003 document? > > > > Thanks ahead of time, > > Mary > > > > "Graham Mayor" wrote: > > > >> In Word vba - Try > >> > >> If Application.Version <> 12 Then > >> ActiveDocument.SaveAs FileName:="filename.docx", FileFormat:=109 > >> Else > >> ActiveDocument.SaveAs FileName:="filename.docx", FileFormat:=12 > >> End If > >> > >> > >> -- > >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<> > >> Graham Mayor - Word MVP > >> > >> My web site www.gmayor.com > >> Word MVP web site http://word.mvps.org > >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<> > >> > >> Andy Fish wrote: > >>> Hello, > >>> > >>> I am trying to automate word 2003 to save a doc file as docx (I have > >>> the converter installed). I am actually using C# but I think the > >>> question would equally apply to all environments > >>> > >>> according to the documentation for word 2007, FileFormat parameter > >>> should be set to wdFormatXMLDocument which has the value 12. > >>> However, this did not work for me. > >>> > >>> is there any way to get this to work for word 2003? > >>> > >>> Andy > > >
From: Doug Robbins - Word MVP on 29 Dec 2009 17:26
The code that Graham provided was to allow a document to be saved in Word 97-2003 format regardless of whether the version of Word was 2007 (Version 12) or an earlier version . There is no difference in the file format of files created in any of the following versions and you cannot save a document in Word 2000 format as there is no such thing. Word 97 Word 2000 Word XP (2002) Word 2003 If you are using Word 2003, the command to save the document as a Word document (the format used for Word 97-2003) is ActiveDocument.SaveAs FileName:="filename.doc", wdFormatDocument I do not know where the "initially a .RTF file" comes into the picture. However, if you did want to save in that format, you would use ActiveDocument.SaveAs FileName:="filename.rtf", wdFormatRTF -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "Kevin T." <Kevin T.(a)discussions.microsoft.com> wrote in message news:38FFCA31-1DA7-4F25-B4B5-13803CC127B4(a)microsoft.com... > Hello, > > Thanks for the forum. I am trying to save a document that has been created > in word 2003. I believe it is initially a .RTF file and we want to then > save > it as a word 2000 .doc. Without going into much detail about why, we have > noticed that the new 2003 files when converted from .RTF to .doc increase > the > size of the file muich more that 2000 did. One of our apps. do not like > it. > > I really like the idea Graham provided for what I am trying to accomplish. > However, I am not sure what I should change. I am guessing we need to make > a > change at the " wdFormatDocumentXX "? > > Regards, > Kevin > > > "Graham Mayor" wrote: > >> If Application.Version < 12 Then >> ActiveDocument.SaveAs FileName:="filename.doc", wdFormatDocument >> Else >> ActiveDocument.SaveAs FileName:="filename.doc", wdFormatDocument97 >> End If >> >> -- >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<> >> Graham Mayor - Word MVP >> >> My web site www.gmayor.com >> Word MVP web site http://word.mvps.org >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<> >> >> >> >> Mary Pytosky wrote: >> > Hi, >> > >> > What would be the code/Fileformat to change the document to be saved >> > as an Office 2003 document? >> > >> > Thanks ahead of time, >> > Mary >> > >> > "Graham Mayor" wrote: >> > >> >> In Word vba - Try >> >> >> >> If Application.Version <> 12 Then >> >> ActiveDocument.SaveAs FileName:="filename.docx", FileFormat:=109 >> >> Else >> >> ActiveDocument.SaveAs FileName:="filename.docx", FileFormat:=12 >> >> End If >> >> >> >> >> >> -- >> >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<> >> >> Graham Mayor - Word MVP >> >> >> >> My web site www.gmayor.com >> >> Word MVP web site http://word.mvps.org >> >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<> >> >> >> >> Andy Fish wrote: >> >>> Hello, >> >>> >> >>> I am trying to automate word 2003 to save a doc file as docx (I have >> >>> the converter installed). I am actually using C# but I think the >> >>> question would equally apply to all environments >> >>> >> >>> according to the documentation for word 2007, FileFormat parameter >> >>> should be set to wdFormatXMLDocument which has the value 12. >> >>> However, this did not work for me. >> >>> >> >>> is there any way to get this to work for word 2003? >> >>> >> >>> Andy >> >> >> |