![]() |
|
|
|
#1
|
|||
|
|||
|
I have a document that is shared by users using both Office 2007 and 2010. As such, with 2010, the SaveAs has been depreciated and I need to use SaveAs2.
When I try to 'trap' this, I receive an error on the Office 2007 machines, as Office 2007 doesn't recognize SaveAs2 in the code. Here's what I have in the Document_Close event: Code:
With ThisDocument
Select Case Application.Version
Case "12.0"
'Save the document
.Save
'Save the document as ARCHIVE
.SaveAs FileName:="\\...\Unit3 Archive\Doc2" & Format(Now(), "yymmdd hh:mm"), _
FileFormat:=wdFormatXMLDocument, _
LockComments:=True, _
Password:="", _
AddToRecentFiles:=False, _
WritePassword:="xxxx", _
ReadOnlyRecommended:=True, _
EmbedTrueTypeFonts:=True, _
SaveNativePictureFormat:=False, _
SaveFormsData:=False, _
SaveAsAOCELetter:=False
Case "14.0"
'Save the document
.Save
'Save the document as ARCHIVE
.SaveAs2 FileName:="\\...\Unit3 Archive\Doc2" & Format(Now(), "yymmdd hh:mm"), _
FileFormat:=wdFormatXMLDocument, _
LockComments:=True, _
Password:="", _
AddToRecentFiles:=False, _
WritePassword:="xxxx", _
ReadOnlyRecommended:=True, _
EmbedTrueTypeFonts:=True, _
SaveNativePictureFormat:=False, _
SaveFormsData:=False, _
SaveAsAOCELetter:=False, _
CompatibilityMode:=14
End Select
End With
|
|
#2
|
||||
|
||||
|
Although, as you say, the SaveAs has been deprecated in Office 2010, that doesn't mean you can't still use the SaveAs method.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
|||
|
|||
|
I have determined why this was failing (GCE - Gross Conceptual Error) on my part.
By including the "SaveAs2" in a module that is compiled during use, it will cause an error. I have moved the "SaveAs" and "SaveAs2" portions to other routines that are called upon, based on the Application.Version. I also overlooked the ":" in the file name, as it is not allowed in the naming of a file. |
|
#4
|
||||
|
||||
|
Fine but, as I said, your can use the Word 2007 'SaveAs' code for both Word 2007 and 2010.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#5
|
|||
|
|||
|
Yes, SaveAs is still available, but only if you wish to save it as a new name, does not allow you to set the following attributes like it used to:
FileFormat LockComments Password AddToRecentFiles WritePassword ReadOnlyRecommended EmbedTrueTypeFonts SaveNativePictureFormat SaveFormsData SaveAsAOCELetter So for that reason, I needed to resolve the way I did. Thank you for your responses though, help is much appreciated. Merry Christmas! |
|
#6
|
||||
|
||||
|
Umm, yes it does. There mere fact they don't appear in the VBA intellisense doesn't mean they've gone away; after all, if that were the case, any code that was brought over to Word 2010 from a previous version would break. That's not what MS has done.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
How do you save different 'versions' onto the same file (Office 2007)
|
kholmesmcgov | Word | 2 | 11-17-2013 01:45 PM |
| Two versions of MS Office | Glenwvdp | Office | 1 | 11-05-2012 02:02 PM |
| Multiple versions of Office on the same network. | whatrudoingdave | Office | 1 | 04-30-2012 03:36 PM |
| using 2 office versions but automaticly chose the old one | garfy | Office | 0 | 07-15-2010 04:48 AM |
MS Office 2007 Versions
|
daufoi | Office | 3 | 01-08-2010 12:51 PM |