Answered by:
word automation

Question
-
Hi,
I have 2 questions about using word automation here.
1. when I use "copy to (file name) type delimited", is there any specific type for word or I can just stay with delimited?
2. If I want to save doc to docx by using saveas(forceext(file name,"docx")), it will cause an error (incompatible issue). I can use it to save xls to xlsx but can't do this for word. any hints?
thanks for your time
Char
Thursday, May 31, 2012 10:01 PM
Answers
-
Giving the document an extension of DOCX doesn't make it a DOCX. If you want to save it in the DOCX format, you need to pass the optional second parameter to SaveAs, specifying the format you want. I think the right value is 12, but you can find the list here: http://msdn.microsoft.com/en-us/library/ff839952.aspx.
Of course, you can only save in DOCX format if you're in Word 2007 or later, or have the compatibility add-on for Word 2003.
Tamar
P.S. Saving an Excel workbook with an extension of XSLX doesn't make it an XSLX file, either. Same solution.
- Proposed as answer by Ed Price - MSFTMicrosoft employee Friday, June 1, 2012 11:46 PM
- Marked as answer by Ed Price - MSFTMicrosoft employee Monday, June 18, 2012 5:14 AM
Friday, June 1, 2012 8:14 PMAnswerer -
Check the workbook's FileFormat property.
Tamar
- Proposed as answer by Ed Price - MSFTMicrosoft employee Monday, June 18, 2012 5:14 AM
- Marked as answer by Ed Price - MSFTMicrosoft employee Monday, June 18, 2012 5:14 AM
Thursday, June 7, 2012 8:34 PMAnswerer
All replies
-
Hi Char,
1. i suggest you to stay with delimited because you can open delimited file in word.
2. give sample code for this question.
Kalpesh
Please "Mark as Answer" if this post answered your question. :)
Kalpesh Chhatrala | Software Developer | Rajkot | India
Kalpesh 's Blog
VFP Form to C#, Vb.Net Conversion UtilityFriday, June 1, 2012 6:20 AMAnswerer -
-
Giving the document an extension of DOCX doesn't make it a DOCX. If you want to save it in the DOCX format, you need to pass the optional second parameter to SaveAs, specifying the format you want. I think the right value is 12, but you can find the list here: http://msdn.microsoft.com/en-us/library/ff839952.aspx.
Of course, you can only save in DOCX format if you're in Word 2007 or later, or have the compatibility add-on for Word 2003.
Tamar
P.S. Saving an Excel workbook with an extension of XSLX doesn't make it an XSLX file, either. Same solution.
- Proposed as answer by Ed Price - MSFTMicrosoft employee Friday, June 1, 2012 11:46 PM
- Marked as answer by Ed Price - MSFTMicrosoft employee Monday, June 18, 2012 5:14 AM
Friday, June 1, 2012 8:14 PMAnswerer -
Giving the document an extension of DOCX doesn't make it a DOCX. If you want to save it in the DOCX format, you need to pass the optional second parameter to SaveAs, specifying the format you want. I think the right value is 12, but you can find the list here: http://msdn.microsoft.com/en-us/library/ff839952.aspx.
Of course, you can only save in DOCX format if you're in Word 2007 or later, or have the compatibility add-on for Word 2003.
Tamar
P.S. Saving an Excel workbook with an extension of XSLX doesn't make it an XSLX file, either. Same solution.
How do I know the excel file made in Excel 2003 or Excel 2007?
Sandor
Sandor
Thursday, June 7, 2012 12:28 PM -
Check the workbook's FileFormat property.
Tamar
- Proposed as answer by Ed Price - MSFTMicrosoft employee Monday, June 18, 2012 5:14 AM
- Marked as answer by Ed Price - MSFTMicrosoft employee Monday, June 18, 2012 5:14 AM
Thursday, June 7, 2012 8:34 PMAnswerer