+ Reply to Thread
Results 1 to 3 of 3

save as "docx"

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    12-01-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2016
    Posts
    949

    save as "docx"

    hi,

    i have a macro that opens a word file(.docm) paste data in it then save as another filename using the below code
    but it saves it also as a ".docm"
    how do i save it as a ".docx"?

     objDoc.SaveAs Filename:=xlRng.Offset(0, -1).Value
      objDoc.Saved = True

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: save as "docx"

    All you need is to include the FileFormat. Try this...

    objDoc.SaveAs fileName:=xlRng.Offset(0, -1).Value, FileFormat:=12
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Valued Forum Contributor
    Join Date
    12-01-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2016
    Posts
    949

    Re: save as "docx"

    hi,

    thanks for the reply
    i googled what 12 means, msdn says its an xml format
    msdn says the docx format is 16
    used
    objDoc.SaveAs fileName:=xlRng.Offset(0, -1).Value, FileFormat:=16
    its saved as a docx format
    thanks again for the additional code
    Last edited by k1dr0ck; 03-21-2018 at 02:55 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Automate "Save" from IE11 "View Downloads" dialog
    By fyongyu09 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-26-2017, 03:03 AM
  2. Receiving "enable content" warning after executing "save as" code
    By phbryan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-11-2014, 12:02 PM
  3. Code only runs when a user hits "Save", not "Save As"
    By cjstewart8 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-04-2014, 07:41 PM
  4. [SOLVED] Script to save to folder in "v:\dept2", confirm file saved, then delete from "v:\dept1"
    By ks100 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-28-2014, 11:42 AM
  5. Create a Command Button to "Save As" and "Close" an Excel Workbook
    By thedunna in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-26-2013, 05:38 PM
  6. "Subscript out of range" error for: Workbooks("Test1.xls").Save
    By Just12341234 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-17-2005, 11:05 AM
  7. [SOLVED] save and restore "Workbook Menu Bar" & "Cell" menus
    By Jeff Higgins in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-13-2005, 10:08 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1