Hi,
I am trying to export excel data to text file in a particular format.
The Format for each ROW of Excel is like
IMAN_ROOT/bin/import_file -f=<Column A> -type=<Column B> -d=<Column C> -ref=<Column D> -vb -log=<Column E>
Every Row of the excel should export in text with this format.
I have been able to export all the cell values for each row but not in this format.
Should i use delimiter for each cell value for each row.
Any help would be highly appreciated.
this is my code for exporting -
Public Sub ExportToTextFile(FName As String, SelectionOnly As Boolean, AppendData As Boolean)
-
-
Dim WholeLine As String
-
Dim FNum As Integer
-
Dim RowNdx As Long
-
Dim ColNdx As Integer
-
Dim StartRow As Long
-
Dim EndRow As Long
-
Dim StartCol As Integer
-
Dim EndCol As Integer
-
Dim CellValue As String
-
-
-
Application.ScreenUpdating = False
-
On Error GoTo EndMacro:
-
FNum = FreeFile
-
-
If SelectionOnly = True Then
-
With Selection
-
StartRow = .Cells(1).Row
-
StartCol = .Cells(1).Column
-
EndRow = .Cells(.Cells.Count).End(xlUp).Row
-
EndCol = .Cells(.Cells.Count).Column
-
End With
-
Else
-
With ActiveSheet.UsedRange
-
StartRow = 4
-
StartCol = .Cells(1).Column
-
EndRow = Cells(50000, "A").End(xlUp).Row
-
EndCol = .Cells(.Cells.Count).Column
-
End With
-
End If
-
-
If AppendData = True Then
-
Open FName For Append Access Write As #FNum
-
Else
-
Open FName For Output Access Write As #FNum
-
End If
-
-
For RowNdx = StartRow To EndRow
-
WholeLine = ""
-
For ColNdx = StartCol To EndCol
-
If Cells(RowNdx, ColNdx).Value = "" Then
-
CellValue = Chr(34) & Chr(34)
-
Else
-
CellValue = Cells(RowNdx, ColNdx).Value
-
End If
-
WholeLine = WholeLine & CellValue & ","
-
Next ColNdx
-
WholeLine = Left(WholeLine, Len(WholeLine) - Len(","))
-
Print #FNum, WholeLine
-
Next RowNdx
-
-
EndMacro:
-
On Error GoTo 0
-
Application.ScreenUpdating = True
-
Close #FNum
-
-
End Sub
-
-
3 4066 NeoPa 32,568
Recognized Expert Moderator MVP prashantdixit: IMAN_ROOT/bin/import_file -f=<Column A> -type=<Column B> -d=<Column C> -ref=<Column D> -vb -log=<Column E>
I have no idea what this is supposed to be describing. Perhaps some example data formatted as you expect it might help.
I have an Excel Worksheet which has 6 Columns
Column A, Column B, Column C, Column D, Column E, Column F.
Now All these Column contain data.
I have got Export Button on the Excel sheet.
1. When user clicks on Export Button then Dialog box open to Save Excel Data in textfile(.txt format only)
2. Let say i have 1000 rows of data corresponding to each column.
3. So in each line of text file , Data from EACH ROW should get exported in this format.
For Row 1
IMAN_ROOT/bin/import_file -f=<Cells(1,"A") > -type=<Cells(1," C")> -d=<Cells(1,"D") > -ref=<Cells(1,"E ")> -vb -log=<Cells(1,"F ")>
Where
<Cells(1, "A")> is Cell value in First Row corresponding to Column A,
<Cells(1, "C")> is Cell value in First Row corresponding to Column C.
PS:
1. I need to values corresponding to Skip Column B for all rows as it is not being used in Format while exporting it to Text file
2. This Text format is basically used to generate a script based on Excel data.
I hope this will help you understanding the problem.
The code has already been posted above through which I have been able to export all the cell values for each row but not in this format.
NeoPa 32,568
Recognized Expert Moderator MVP NeoPa: Perhaps some example data formatted as you expect it might help.
You don't have to pay any attention to what I suggest, but I can't help thinking it would be sensible.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Vanessa |
last post by:
I need to read/extract data from an Excel file using ASP. However, the Excel
file is not in regular tabular format; instead, it is actually a form.
Therefore, it contains many checkbox and merged cells with data.
I have followed this web page's instruction
(http://www.haneng.com/Forums_Post.asp?id=4099) to read data out, but
whenever the cell has checkbox or it is a merged cell, it can't read the
data.
Is there anyway to read data...
|
by: Odd Bjørn Andersen |
last post by:
When exporting character data with column length greater than 254, the data
is truncated. For some reason I have to export the data in DEL format. Is
there a way to avoid the truncation of data ?
--
Regards
-----------
Odd Bjørn Andersen
ErgoSolutions AS
|
by: Mads Petersen |
last post by:
I'm stuck in this code. Hope you can and will help me. I launch it
from excel.
I have made the following code work, but not as i whant. I need the
ranges to be working with something like xlDown.
eg. this only transferes the first record in the area.
..Fields("Uge").Value = ws.Range("A98").Value
Sub SelectMaster()
|
by: Niklas |
last post by:
Hi
Before I start coding I need to be sure that nobody else has not done it yet
and that I can use it.
I need an import utility which import data from Excel to a database or some
object in .NET. The data in Excel is not in structured columns but can exist
everywhere in the workbook. For example if I am supposed to import a person
and all his/her cars which exist in a workbook I want to be able to create an
import protocol and specify...
|
by: vbvr |
last post by:
I need to export a numeric field (TAX ID) from vb.net to Excel. The value gets converted to Numeric in Excel and leading zeroes are lost. I tried to use code posted on this site. But the style defined here does not get applied in Excel. Following is the sample code.
Any suggestions on how to keep the text "02345" in the same format in Excel?
>>>>>>>>>>>>>>>>>>>>
Dim Excel As New Excel.Application
Dim wb As Excel.Workbook
...
| |
by: panku007 |
last post by:
hi All,
I wanted to export excel data into ms word document through
java coding.So please send me reply,according to my question.
thanks
|
by: san1014 |
last post by:
Hi
How to import and export excel data into oracle database using java.
Thank you
|
by: farukcse |
last post by:
Dear Sir,
I have a PHP script that export CSV with arabic text, for example I download the CSV on the website then save to desktop of my computer and Open it on NOTEPAD... that works fine I could still see all the arabic text OK with no problem, but if I open the CSV file in Microsoft EXCEL, all the arabic text are busted and no longer readable.
arabic text is inserted and stored in database as UTF-8 format.
Do you know a solution for...
|
by: shigehiro |
last post by:
Hi all,
I tried to export the data into .csv format.. and the below is how I do it:
container.REQUEST.RESPONSE.setHeader('Content-Type','text/csv')
container.REQUEST.RESPONSE.setHeader('Content-Disposition', 'attachment;filename=outputFile.csv')
container.REQUEST.RESPONSE.write(outputString)
The above works completely fine when I tested it in Firefox, but when I used IE, it will prompt user to save file as a 'Document' file type (&...
|
by: beulajo |
last post by:
Hai. I have student marks in excel sheet. I need to export this data in to msaccess. I have no problem in exporting the data. My excel sheet is in this format
I have 40 students. Each student had attended 9 tests which has 5 criteria, under which marks had been given(10).
one sample data is
B0841 Albert Raja A.
0 0 0 0 0
0 0 0 0 0.5
2 2 0 0 1
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |