473,398 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

export to txt file

137 100+
hi everyone

i have one grid in my application. i have exported the data to the word file, now i want to export it to notepad. is it possible? if yes then how? i am waiting for the reply. plz help
TIA
Sep 27 '07 #1
6 3654
QVeen72
1,445 Expert 1GB
Hi,

What code u have used to export to Word File?
Try using the same code u use to create txt file..


Regards
Veena
Sep 27 '07 #2
coolminded
137 100+
Thanx Veena for your reply
do i need to add any references as i do it for the word document.
my code is
Expand|Select|Wrap|Line Numbers
  1. Dim oWord As word.Application
  2. Dim oDoc As word.Document
  3. Dim i As Integer
  4.  
  5.     Set oWord = New word.Application
  6.     Set oDoc = New word.Document
  7.     oDoc.PageSetup.Orientation = wdOrientLandscape
  8.  
  9. oDoc.ActiveWindow.Selection.Tables.add Range:=oDoc.ActiveWindow.Selection.Range, numrows:=1, numcolumns:=mg3.Cols
  10.  
  11. oDoc.Tables(1).Columns(1).Cells(1).Range.Text = "Sn"
  12.             oDoc.Tables(1).Columns(2).Cells(1).Range.Text = "Name"
  13.             oDoc.Tables(1).Columns(3).Cells(1).Range.Text = "Address"
  14.             oDoc.Tables(1).Columns(4).Cells(1).Range.Text = "Tel No"
  15.             oDoc.Tables(1).Columns(5).Cells(1).Range.Text = "E-mail"
  16.  
  17. For i = 1 To mg3.Rows - 1
  18.  
  19. oDoc.Tables(1).Columns(1).Cells.add
  20.           oDoc.Tables(1).Columns(1).Width = 30
  21.           oDoc.Tables(1).Columns(1).Cells(i + 1).Range.Text = i
  22.  
  23. oDoc.Tables(1).Columns(2).Cells(i + 1).Range.Text = mg1.TextMatrix(i, 1)
  24.             oDoc.Tables(1).Columns(3).Cells(i + 1).Range.Text = mg1.TextMatrix(i, 2)
  25.             oDoc.Tables(1).Columns(4).Cells(i + 1).Range.Text = mg1.TextMatrix(i, 3)
  26.             oDoc.Tables(1).Columns(5).Cells(i + 1).Range.Text = mg1.TextMatrix(i, 4)
  27. Next i
  28.  
  29. oDoc.ActiveWindow.Document.Close True
  30.     Set oDoc = Nothing
  31.     oWord.Quit False
  32.     Set oWord = Nothing
  33. Set Db = Nothing
  34.  
  35.  

do i need to change anything in my code. it shows the table, but how i can generate a table in notepad. plz help
i may not need the table in txt file but the data must be shown separated by 'tab'

thanx
Sep 28 '07 #3
coolminded
137 100+
Thanx Veena for your reply
do i need to add any references as i do it for the word document.
my code is
Expand|Select|Wrap|Line Numbers
  1. Dim oWord As word.Application
  2. Dim oDoc As word.Document
  3. Dim i As Integer
  4.  
  5.     Set oWord = New word.Application
  6.     Set oDoc = New word.Document
  7.     oDoc.PageSetup.Orientation = wdOrientLandscape
  8.  
  9. oDoc.ActiveWindow.Selection.Tables.add Range:=oDoc.ActiveWindow.Selection.Range, numrows:=1, numcolumns:=mg3.Cols
  10.  
  11. oDoc.Tables(1).Columns(1).Cells(1).Range.Text = "Sn"
  12.             oDoc.Tables(1).Columns(2).Cells(1).Range.Text = "Name"
  13.             oDoc.Tables(1).Columns(3).Cells(1).Range.Text = "Address"
  14.             oDoc.Tables(1).Columns(4).Cells(1).Range.Text = "Tel No"
  15.             oDoc.Tables(1).Columns(5).Cells(1).Range.Text = "E-mail"
  16.  
  17. For i = 1 To mg3.Rows - 1
  18.  
  19. oDoc.Tables(1).Columns(1).Cells.add
  20.           oDoc.Tables(1).Columns(1).Width = 30
  21.           oDoc.Tables(1).Columns(1).Cells(i + 1).Range.Text = i
  22.  
  23. oDoc.Tables(1).Columns(2).Cells(i + 1).Range.Text = mg1.TextMatrix(i, 1)
  24.             oDoc.Tables(1).Columns(3).Cells(i + 1).Range.Text = mg1.TextMatrix(i, 2)
  25.             oDoc.Tables(1).Columns(4).Cells(i + 1).Range.Text = mg1.TextMatrix(i, 3)
  26.             oDoc.Tables(1).Columns(5).Cells(i + 1).Range.Text = mg1.TextMatrix(i, 4)
  27. Next i
  28.  
  29. oDoc.ActiveWindow.Document.Close True
  30.     Set oDoc = Nothing
  31.     oWord.Quit False
  32.     Set oWord = Nothing
  33. Set Db = Nothing
  34.  
  35.  

do i need to change anything in my code. it shows the table, but how i can generate a table in notepad. plz help
i may not need the table in txt file but the data must be shown separated by 'tab'

thanx
Sep 28 '07 #4
QVeen72
1,445 Expert 1GB
Hi,

Notepad dosent support Tables, so, u will have to use Tabs or ; or | or Special Character and make look like Tables,
use File IO to export to txt file. For this, u dont need any references..


REgards
Veena
Sep 28 '07 #5
coolminded
137 100+
Could you please give me some hint how can i use File IO, or could you plz give me some code snippet on how to export to txt file.
thanx once again
Sep 28 '07 #6
QVeen72
1,445 Expert 1GB
Hi,

This is just basic File Handling in VB6:
No references needed..

Expand|Select|Wrap|Line Numbers
  1. Dim FN As Long
  2. FN = FreeFile
  3. Open "C:\MyTextFile.txt" For Output As FN
  4. Print #FN, "This Is My First Line From VB6"
  5. Print #FN, "This Is My Second Line From VB6"
  6. Close FN
  7. MsgBox "Check  Text File   C:\MyTextFile.txt"
  8.  
Regards
Veena
Sep 28 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: DarkSpy | last post by:
many c++ compilers including "gcc" have not implemented the "export" keyword, but the comeau compilers made it (just i knew). i want to know about: is it too difficult to implement "export"...
0
by: Shawn Mehaffie | last post by:
I have the following class that I've wirtten to take a Dataset and automatically export it to either XML, ASCII or Tab delimited file. The reason I wrote it they way I did was that I don't want to...
205
by: Jeremy Siek | last post by:
CALL FOR PAPERS/PARTICIPATION C++, Boost, and the Future of C++ Libraries Workshop at OOPSLA October 24-28, 2004 Vancouver, British Columbia, Canada http://tinyurl.com/4n5pf Submissions
6
by: maricel | last post by:
Is there anybody out there who have any idea why EXPORT is relatively slower when putting the output file on a network drive - map drive from onother PC compared to putting it on my local PC drive...
5
by: Tim Eliot | last post by:
Just wondering if anyone has hit the following issue and how you might have sorted it out. I am using the command: DoCmd.TransferText acExportMerge, , stDataSource, stFileName, True after...
0
by: Shawn Mehaffie | last post by:
I have the following class that I've wirtten to take a Dataset and automatically export it to either XML, ASCII or Tab delimited file. The reason I wrote it they way I did was that I don't want to...
1
by: chaitu | last post by:
Hi, Can anybody tell me what the error code for Export is. Like i get the message SQL3104N The Export utility is beginning to export data to file...
4
by: Steven T. Hatton | last post by:
<quote url="http://www.informit.com/guides/content.asp?g=cplusplus&seqNum=53&rl=1"> exported Templates Last updated Sep 6, 2006. exported Templates The separate compilation model enables...
9
by: NEWSGROUPS | last post by:
I have data in a table in an Access 2000 database that needs to be exported to a formatted text file. For instance, the first field is an account number that is formatted in the table as text and...
8
by: iheartvba | last post by:
Hi I am using Access 2007 and am trying to export a query to a fixed length text file. I tried using the following code to export the text file: DoCmd.TransferText acExportFixed, , "qryFFRDeFile",...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.