Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Paste Data To WordPad TXT File
I have a fairly simple macro that copies data from a few sheets and
consolidates it (via paste) into one sheet. I know what to copy this consoldiates data in this sheet (say A1:G65) and I want to copy it and paste it into a wordpad document file (NewData.txt) and save the txt file once it is pasted so i can then do some different work with the txt file. How do i call these tasks from within an excel macro? thx davem |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Paste Data To WordPad TXT File
You can't automate WordPad or NotePad, unless you use the dreaded SendKeys
method. It would be much easier to use VB's own file input/output functions to write the text file. Something along the lines of Sub WriteToTextFile() Dim FName As Variant Dim FNum As Integer Dim R As Range FName = Application.GetSaveAsFilename(filefilter:="Text Files (*.txt),*.txt") If FName = False Then ' user cancelled Exit Sub End If FNum = FreeFile() Open FName For Output Access Write As #FNum For Each R In Range("A1:A10") Print #FNum, R.Text Next R Close #FNum End Sub See also www.cpearson.com/Excel/ImpText.aspx -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "DaveM" wrote in message ... I have a fairly simple macro that copies data from a few sheets and consolidates it (via paste) into one sheet. I know what to copy this consoldiates data in this sheet (say A1:G65) and I want to copy it and paste it into a wordpad document file (NewData.txt) and save the txt file once it is pasted so i can then do some different work with the txt file. How do i call these tasks from within an excel macro? thx davem |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
connecting wordpad and excel | Excel Discussion (Misc queries) | |||
WordPad file convert in Excel | Excel Discussion (Misc queries) | |||
Excel cut/Paste Problem: Year changes after data is copy and paste | Excel Discussion (Misc queries) | |||
i try to open Excel spreadsheets, and they open in wordpad-- | Excel Discussion (Misc queries) | |||
When sending file via email, cannot paste Excel data into body of letter. | Excel Discussion (Misc queries) |