Solved

Save word document as docx from user form - want user to be able to browse for file location

Posted on 2016-07-14
3
78 Views
Last Modified: 2016-07-18
Hi Experts,

I'm creating a word macro enabled document (docm) that I want the user to be able to save as a word document (docx) by pressing a button (savecmd) in a userform (saveform). I've got a text box on the form (FileNametxt) where I want them to be able to write the name of the file name that the document will be saved as.

I'd also like to add a feature so they can browse for the best file location where the file will be saved.

Any advice on how I can do this?

Thanks in advance for your help
0
Comment
Question by:martywal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 51

Expert Comment

by:Rgonzo1971
ID: 41710633
Hi,

why not

Sub SaveMe()
    Set dlgSaveAs = Dialogs(wdDialogFileSaveAs)
    With dlgSaveAs
        .Name = "myDocument" ' suggested name
        .Format = wdFormatXMLDocument
        .Show
    End With
End Sub

Open in new window

0
 
LVL 51

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 41710658
to force docx then use

Sub SaveMeAsDocx()

With Dialogs(wdDialogFileSaveAs)
.Format = wdFormatXMLDocument
If .Display = 0 Then Exit Sub
If .Format = wdFormatXMLDocument Then
    .Execute
Else
   MsgBox ("You are only allowed to save in docx format.  Please try again")
   Call SaveMeAsDocx
End If
End With

Open in new window

0
 

Author Closing Comment

by:martywal
ID: 41718157
Thanks Rgonzo1971, that did just as I was after. Vey helpful! Thx
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question