473,378 Members | 1,671 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,378 software developers and data experts.

Convert CSV (semicolon separated) to XLS using VBS

1
Is it possible to do it reverse way ?

I need to convert csv file

DATE;DEPART;CLA;SERV;ERRE;MESE;SCHEE;TYP;DUREE;TAI ;FICH;RE;Date o;Date f;Com 2012-05-07;21:02:04; da_nbondv02_data;nbondv02;0;OK;lmejvd-diff-2sem;da;00:02:20;41272;32;2 Sem 2012-05-07;21:00:00; da_nbondv02_sys;nbondv02;0;OK;lmmjvd-diff-2sem;da;00:04:04;356070;2109;2 Sem 2012-05-07;21:01:39; da_nbondv03_data;nbondv03;0;OK;lmejvd-diff-2sem;da;00:07:55;224387;3335;2 Sem

in to XLS.

I used this code

Function ok()
set ce = CreateObject("Excel.Application")

newFileName="C:\BE\testnew.xls"
ce.Workbooks.Open "C:\BE\1.csv"
ce.ActiveWorkbook.SaveAs newFileName
ce.ActiveWorkbook.Close(0)
ce.Quit
Set ce = Nothing

end function

It's converting to XLS but without columns, just row by row. I need to use VB Script to do it as function and remember that all " ; " starting with new column in XLS

Please help.
May 10 '12 #1
2 3876
Guido Geurs
767 Expert 512MB
Q1: Is the data you entered = 1 row in XLS?
Q2: are there a lot of rows? more than +-200 ?

1st solution: (a few rows)
- Read a line of the data.
- Split the line on ";" in an array
- put the array in the next empty row on the sheet.

2nd solution:( a lot of rows)
- read all the data in an array
- split the data from the first array in a second array.
- dump the second array in the sheet.
May 13 '12 #2
Killer42
8,435 Expert 8TB
You don't need to split up the data yourself; Excel will do that for you.

Try this VBA statement...
Expand|Select|Wrap|Line Numbers
  1. Workbooks.OpenText Filename:= _
  2. "C:\BE\1.csv", Origin:=xlWindows, _
  3. StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlNone, _
  4. ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=True, Comma:=False _
  5. , Space:=False, Other:=False
May 22 '12 #3

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

Similar topics

0
by: Zak Chababe | last post by:
Hi, We are in the process of converting thousands of MS word documents into some sort of database files like sql or comma separated files. Is there something out there with Perl that allows me to...
2
by: news | last post by:
We just upgraded our phpMyAdmin GUI to the latest stable version, and now the SQL queries are doing odd additions. First, without changing the database it's connecting to at all, there's a new...
5
by: Michael Sperlle | last post by:
Is it possible? Bestcrypt can supposedly be set up on linux, but it seems to need changes to the kernel before it can be installed, and I have no intention of going through whatever hell that would...
10
by: bonnie.tangyn | last post by:
Dear all In my ASP page, user can enter date in dd/mm/yyyy format. How can I use Javascript to convert dd/mm/yyyy to yyyy-mm-dd hh:mm:ss. Please give me some advices. Cheers Bon
2
by: kolla | last post by:
how to write a c programme to print a semicolon without writing using a semicolon in the main program
6
by: Muthu08 | last post by:
Hello Experts, I'm trying to convert an dynamic XML doc into HTML using XSLT. In the example I have shown one form(form1)...But there could be multiple forms....names are unknown and each one...
4
by: thomasc1020 | last post by:
This is regarding VB.NET 2003. Variable 'Date' is a string and it contains date information in this format: "DEC/05/2007". Now I am trying to convert the format as "2007-12-05". Is it...
7
Breezwell
by: Breezwell | last post by:
Hi everyone, Here is a little something I have been trying to implement, however I am not sure I am on the right path. To start, I have a query of product numbers such as the following: ...
6
by: BOMEz | last post by:
So i've recently been starting to program PHP in an object oriented way, but I'm running into some difficulties in from a design stand point and from an object oriented stand point: Issue 1: In my...
3
by: beulajo | last post by:
How to convert comma separated field value into respective rows in query? I have a field say Type="data1,type1,string1,tom" This is one field of a table which consists of 5 other fields My...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.