Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-07-2018, 08:50 AM
staicumihai staicumihai is offline Macro to save Word 2007 document using info from Quick Parts Windows 7 32bit Macro to save Word 2007 document using info from Quick Parts Office 2010 32bit
Advanced Beginner
Macro to save Word 2007 document using info from Quick Parts
 
Join Date: Dec 2015
Posts: 33
staicumihai is on a distinguished road
Default 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"
Do you know what I should modify to make it work ?

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
Reply With Quote
  #2  
Old 08-07-2018, 07:57 PM
gmayor's Avatar
gmayor gmayor is offline Macro to save Word 2007 document using info from Quick Parts Windows 10 Macro to save Word 2007 document using info from Quick Parts Office 2016
Expert
 
Join Date: Aug 2014
Posts: 3,302
gmayor is a name known to allgmayor is a name known to allgmayor is a name known to allgmayor is a name known to allgmayor is a name known to allgmayor is a name known to all
Default

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
Reply With Quote
  #3  
Old 08-08-2018, 01:21 AM
staicumihai staicumihai is offline Macro to save Word 2007 document using info from Quick Parts Windows 7 32bit Macro to save Word 2007 document using info from Quick Parts Office 2010 32bit
Advanced Beginner
Macro to save Word 2007 document using info from Quick Parts
 
Join Date: Dec 2015
Posts: 33
staicumihai is on a distinguished road
Default

Thanks a lot
Reply With Quote
Reply

Thread Tools
Display Modes


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
Macro to save Word 2007 document using info from Quick Parts Cannot save Quick Parts autotext in Word 2010 EST_DC Word 2 07-27-2016 03:27 PM
Macro to save Word 2007 document using info from Quick Parts 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

Other Forums: Access Forums - Senior Forums

All times are GMT -7. The time now is 06:18 AM.


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