#1
|
|||
|
|||
Macro to save Word 2007 document using info from Quick Parts
Hi guys,
I have a macro below that used to work in Microsoft Word 2010 and now that I have installed Microsoft Word 2007 it doesnt work to save the document with the new name as docx. I get an error on this line Code:
ActiveDocument.SaveAs2 strDrive & fisword & ".docx" Code:
Option Explicit Sub FPVS() Dim fisword As String Dim FOLDER As String Dim cinci As String Dim cinci1 As String Dim raport As String Dim FPVS As String Dim nrfpvs As String Dim anfpvs As String Dim nr As String Dim MARCA As String Dim data As String Dim data1 As String Dim data2 As String Dim separate() As String Dim marca1() As String Dim PAGUBIT As String Dim pagubit1() As String Dim pagubit2 As String Dim pagubit3() As String Dim separat1 As String Dim nume1 As String Dim prenume1 As String Dim prenume11 As String Const strDrive As String = "D:\MIHAI\FPVS\" raport = Trim(ActiveDocument.BuiltInDocumentProperties("Title").Value) FPVS = ActiveDocument.BuiltInDocumentProperties("keywords").Value nr = Replace(Trim(ActiveDocument.BuiltInDocumentProperties("Company").Value), Chr(45), "") MARCA = ActiveDocument.BuiltInDocumentProperties("Comments").Value data = ActiveDocument.BuiltInDocumentProperties("Content status").Value cinci = Right(Replace(Trim(ActiveDocument.BuiltInDocumentProperties("keywords").Value), "/", ".") & Chr(32), 6) cinci1 = Replace(cinci, " ", "") nume1 = ActiveDocument.BuiltInDocumentProperties("Author").Value separate = Split(FPVS, "/") nrfpvs = separate(0) anfpvs = separate(1) anfpvs = Right(anfpvs, 2) marca1 = Split(MARCA, " ") data1 = Left(data, Len(data) - 4) data2 = Right(data, Len(data) - 8) data = data1 & data2 fisword = "R" & raport & nrfpvs & "-" & anfpvs & " " & nr & " " & marca1(0) FOLDER = "FPVS" & " " & nrfpvs & "-" & anfpvs ActiveDocument.SaveAs2 strDrive & fisword & ".docx" ActiveDocument.SaveAs2 FileName:=strDrive & "\" & fisword & ".doc", FileFormat:=wdFormatDocument ActiveDocument.ExportAsFixedFormat OutputFileName:=strDrive & fisword & ".pdf", _ ExportFormat:=wdExportFormatPDF, _ OpenAfterExport:=False, _ OptimizeFor:=wdExportOptimizeForPrint, _ Range:=wdExportAllDocument, From:=1, to:=1, _ Item:=wdExportDocumentContent, _ IncludeDocProps:=True, _ KeepIRM:=True, _ CreateBookmarks:=wdExportCreateHeadingBookmarks, _ DocStructureTags:=True, _ BitmapMissingFonts:=True, _ UseISO19005_1:=False lbl_Exit: With Application .ScreenUpdating = False 'Loop Through open documents Do Until .Documents.Count = 0 'Close no save .Documents(1).Close SaveChanges:=wdSaveChanges Loop 'Quit Word save .Quit SaveChanges:=wdSaveChanges End With Exit Sub End Sub |
#2
|
||||
|
||||
SaveAs2 was introduced in Word 2010. It is not available in Word 2007. Use SaveAs.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
Thanks a lot
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Cant save document as docx or doc using macro in Word 2007 | staicumihai | Word VBA | 1 | 04-27-2018 10:59 AM |
Cannot save Quick Parts autotext in Word 2010 | EST_DC | Word | 2 | 07-27-2016 03:27 PM |
Looking for info on background save in Word 2007 | WaltR | Word | 4 | 05-25-2012 09:17 AM |
Deleting Quick Parts in 2007 | tazeo | Office | 2 | 02-12-2012 03:20 PM |
Word 2007 Quick Parts | kateVanG | Word | 2 | 04-15-2009 07:04 PM |