Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Copy rows from excel sheet to a word document

Hi Ashish,

in VBA editor: Tools References check Microsoft Scripting Runtime

Regards,
Ivan

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
how do i copy an excel spreadsheet into word document with a table db Excel Discussion (Misc queries) 1 January 23rd 08 03:16 PM
Copy table from Word Document to Excel Mythili Excel Discussion (Misc queries) 0 May 3rd 07 10:50 AM
Want to insert Excel sheet in Word document - comes out too big. Chicago Excel Discussion (Misc queries) 4 March 30th 06 11:52 PM
How do I copy a Word document into Excel and have it look good? djsgrammy Excel Discussion (Misc queries) 2 February 7th 06 11:36 PM
Copy a form from excel into a new word document kevin Excel Programming 3 January 28th 05 04:15 PM


All times are GMT +1. The time now is 05:02 AM.

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"