Consulting

Results 1 to 3 of 3

Thread: set save as name

  1. #1

    set save as name

    hi
    i have a user form that inputs data into a table in word. id like to code it to set the "save as" name and save the word document after it has input the data. i would like it to take the "save as" name from two text boxes in the userform and combine them as 1 name to save the word doc.

    eg.

    user form
    text box 1 = 12001
    text box 2 = Mr Smith

    word doc save as
    12001 Mr Smith

    any help please
    thanks ash

  2. #2
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    Assuming you are willing to accept the default PATH...[vba]ActiveDocument.SaveAs Filename:= TextBox1.text & TextBox2.Text[/vba]

  3. #3
    VBAX Mentor Teeroy's Avatar
    Joined
    Apr 2012
    Location
    Sydney, Australia
    Posts
    414
    Location
    fpath="c:\" 'change to your path
    fname = text_box_1 & "_" & text_box_2
    ActiveDocument.SaveAs fpath & fname
    Last edited by Aussiebear; 04-02-2023 at 04:57 PM. Reason: Adjusted the code tags
    _________________________________________________________________________
    "In theory there is no difference between theory and practice. In practice there is." - Chuck Reid

    Any day you learn something new is a day not wasted.

Posting Permissions

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