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 4043 NeoPa 32,556
Expert Mod 16PB 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,556
Expert Mod 16PB 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...
|
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 ?
...
|
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....
|
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...
|
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...
|
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...
|
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')...
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
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...
|
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,...
|
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,...
|
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...
|
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...
|
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,...
|
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...
| |