Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy rows from excel sheet to a word document
Hi, I want to copy the records from excel sheets into a txt using macro? Is there any way to do the same? Regards, Ashish -- ashishprem ------------------------------------------------------------------------ ashishprem's Profile: http://www.excelforum.com/member.php...o&userid=31485 View this thread: http://www.excelforum.com/showthread...hreadid=536743 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy rows from excel sheet to a word document
Hi Ashish,
yes, it is possible with code like this: Sub WriteToTextFile Dim fsFs As Scripting.FileSystemObject Dim fsOutput As Scripting.TextStream Dim OutputFile as String OutputFile = ' here add path and filename, maybe also result of _ application.getsaveasfilename Set fsFs = New FileSystemObject Set fsOutput = fsFs.OpenTextFile(Filename:=OutputFile, IOMode:=ForWriting, create:=True, Format:=TristateUseDefault) fsOutput.writeline "here add what you want to write" fsOutput.close end sub You need to set reference to Microsoft Scripting Runtime when trying to run this code. If anything is not clear, please let me know. Regards, Ivan |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy rows from excel sheet to a word document
Not clear with referencing the Microsoft Scripting Runtime . how to d it. Thanks for the help -- ashishpre ----------------------------------------------------------------------- ashishprem's Profile: http://www.excelforum.com/member.php...fo&userid=3148 View this thread: http://www.excelforum.com/showthread.php?threadid=53674 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy rows from excel sheet to a word document
Hi Ashish,
in VBA editor: Tools References check Microsoft Scripting Runtime Regards, Ivan |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy rows from excel sheet to a word document
You don't need the scripting runtime.
It could be as simple as Thisworkbook.SavesAs "C:\Myfolder\Myfile.csv", xlCSV or http://www.cpearson.com/excel/imptext.htm import/export text files as an example. Of course the scripting runtime is a third option. -- Regards, Tom Ogilvy "ashishprem" wrote: Hi, I want to copy the records from excel sheets into a txt using macro? Is there any way to do the same? Regards, Ashish -- ashishprem ------------------------------------------------------------------------ ashishprem's Profile: http://www.excelforum.com/member.php...o&userid=31485 View this thread: http://www.excelforum.com/showthread...hreadid=536743 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy rows from excel sheet to a word document
Thanks a lot. its working fine -- ashishprem ------------------------------------------------------------------------ ashishprem's Profile: http://www.excelforum.com/member.php...o&userid=31485 View this thread: http://www.excelforum.com/showthread...hreadid=536743 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how do i copy an excel spreadsheet into word document with a table | Excel Discussion (Misc queries) | |||
Copy table from Word Document to Excel | Excel Discussion (Misc queries) | |||
Want to insert Excel sheet in Word document - comes out too big. | Excel Discussion (Misc queries) | |||
How do I copy a Word document into Excel and have it look good? | Excel Discussion (Misc queries) | |||
Copy a form from excel into a new word document | Excel Programming |