Avatar of martywal
martywal

asked on 

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

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
Microsoft WordVB Script

Avatar of undefined
Last Comment
martywal
Avatar of Rgonzo1971
Rgonzo1971

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

ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of martywal
martywal

ASKER

Thanks Rgonzo1971, that did just as I was after. Vey helpful! Thx
VB Script
VB Script

VBScript (Visual Basic Scripting Edition) is an interpreted scripting language developed by Microsoft that is modeled on Visual Basic, but with some important differences. VBScript is commonly used for automating administrative and other tasks in Windows operating systems (by means of the Windows Script Host) and for server-side scripting in ASP web applications. It is also used for client-side scripting in Internet Explorer, specifically in intranet web applications.

39K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo