Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Textbox.Value as a new text file

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Textbox.Value as a new text file

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


--
Dan
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Textbox.Value as a new text file

Thanks a lot
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Textbox.Value as a new text file


Dan,

How can I force the file to be saved as .txt only?
Thanks

"Dan R." wrote:

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


--
Dan

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using a TextBox value in a file String Mark Dullingham Excel Programming 4 March 9th 07 03:09 PM
textbox to file (.txt or .doc) Kagan Clearwater Excel Programming 1 November 28th 06 06:07 AM
Highlight all Text in a Textbox when the textbox is selected RPIJG[_73_] Excel Programming 3 October 28th 05 08:28 PM
Textbox & Save file problem Stuart[_5_] Excel Programming 0 August 4th 04 07:09 PM
check variable(text) with cell (text), textbox Mark[_17_] Excel Programming 1 August 27th 03 01:15 PM


All times are GMT +1. The time now is 08:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"