Textbox.Value as a new text file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to prompt the Save as dialog box, filter by *doc (and *.txt
if possible) have the Textbox.Value as the body of the txt/doc file which
will be named by the user to his/her convenience.

Thanks in advance
 
Luis,

Try something like this:


Private Sub CommandButton1_Click()
'must have a reference to the word object library
Dim wdApp As Word.Application
Dim wdDoc As Word.Document
Set wdApp = CreateObject("Word.application")
Set wdDoc = wdApp.Documents.Add

'wdApp.Visible = True
wdDoc.Sentences(1) = Me.TextBox1.Text

wdApp.ActiveDocument.Save
wdDoc.Close
Set wdDoc = Nothing
wdApp.Quit
Set wdApp = Nothing
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top