none
VB.Net - Save active document as the text within two textboxes RRS feed

  • Question

  • Hello,

    I'm trying to figure out how to save a document produced by my form application as the contents of two textboxes.

    The first textbox has a person's last name, the second textbox has the first name.  What I want to do is click a command button and save my active document to a folder on my harddrive located at C:\Active Clients\

    So in effect, I'd like the result of my documts to save in the following directory:

    C:\Active Clients\LastName(aka TextBox1), First Name (aka TextBox2)

    Anyone able to help me out with this one?  Not sure how to go about doing this.


    • Edited by MBuchok Tuesday, June 26, 2012 1:03 AM
    Tuesday, June 26, 2012 1:02 AM

Answers

  • I answered my own question... was rather easy actually...

            Dim oword As Word.Application
            Dim MyPath As String
    
            MyPath = "C:\Templates\" & NameTB.Text
    
            oword.ActiveDocument.SaveAs(FileName:=MyPath & ".doc")

    • Marked as answer by MBuchok Tuesday, June 26, 2012 1:15 AM
    Tuesday, June 26, 2012 1:15 AM

All replies

  • I answered my own question... was rather easy actually...

            Dim oword As Word.Application
            Dim MyPath As String
    
            MyPath = "C:\Templates\" & NameTB.Text
    
            oword.ActiveDocument.SaveAs(FileName:=MyPath & ".doc")

    • Marked as answer by MBuchok Tuesday, June 26, 2012 1:15 AM
    Tuesday, June 26, 2012 1:15 AM
  • Hi LAssist2012,

    I’m glad to hear that you have solved your issue. Thanks for sharing your experience here. It’s very beneficial for other community members who have similar problem to see how you solved your question.

    Best regards,
    Quist


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, June 26, 2012 6:02 AM
    Moderator