SlideShare uma empresa Scribd logo
1 de 15
Baixar para ler offline
Web-IT Support and Consulting
Web-IT Support and Consulting
A human vision on the digital world
Web-IT Support and Consulting
Still using dBase?
One would be surprised how many dBase databases are still
active in companies.
But what if you intend to migrate to
MS SQL Server or just want to export all these files into a *.CSV
format for further use?
Not an easy task, lots of effort and really time consuming.
That’s why I want to share the next solution with you
(download the slide share file to use the copy-paste function).
Enjoy reading and for any additional question,
just give a ring to my team (info at the last page).
Cheeriooo,
Webby (that’s me)
Web-IT Support and Consulting
Why this solution
My boss and his (my) team
always have creative
solutions and like to share
them.
Fastest way to convert hundreds of dBase files in 1 go
Countering the fact that MS Excel doesn’t use the system settings
(delimiters) in VBA code (more on this can be found on the web)
Solid basis to use the *.CSV files in MS Excel
or as bulk import files in MS SQL Server
Web-IT Support and Consulting
Step 1
Yep, this looks
easy to me.
Create a new MS Excel file and save it with the option
Define a sheet where people can enter the location of their sources
and destinations
Web-IT Support and Consulting
Step 2.1
Hey guys, wait a second. By default the
‘DEVELOPER’ menu is not activated.
To do so follow these steps:
1. Click on File >> Options >> Customize Ribbon
2. Select in the right pane the ‘Developer’ tab.
3. Click OK.
Create a new macro (module) in the same MS Excel file
(that’s why you had to save as a Macro-enabled workbook)
Web-IT Support and Consulting
Step 2.2
Easy peasy
Create a new macro (module) in the same MS Excel file
(that’s why you had to save as a Macro-enabled workbook)
Web-IT Support and Consulting
Step 3.1
Green text
gives all the
information on
the code
Paste all the code on the following pages one after the other in the
module Window
Sub ExportdBaseFiles()
' -------------------------------------------------------
' Definition of variables
' -------------------------------------------------------
Dim OriginalFolderName As String
Dim OriginalFileName As String
Dim SaveAsFolderName As String
Dim SaveAsFileName As String
Dim LastCol As Integer
Dim LastRow As Long
Dim LoopInRows As Long
Dim LoopInCols As Integer
Dim SaveAsFileNumber As Integer
Dim DelimiterSign As String
Dim SaveAsExtension As String
' -------------------------------------------------------
Start of SUB
Download the presentation
to be able to copy-paste.
Web-IT Support and Consulting
Step 3.2
Green text
gives all the
information on
the code
Paste this code after the previous one
' -------------------------------------------------------
' Initializing variables
' -------------------------------------------------------
' Refer as much as possible to cell values so the end-users can define their
own sources and destinations.
OriginalFolderName = Range("C2").Value
SaveAsFolderName = Range("C3").Value
OriginalFileName = Dir(OriginalFolderName & Range("C4").Value)
SaveAsFileName = ""
DelimiterSign = Range("C5").Value
SaveAsFileNumber = FreeFile ' FreeFile defines a file number that is not yet used.
SaveAsExtension = Range("C6").Value
' -------------------------------------------------------
Web-IT Support and Consulting
Step 3.3
Green text
gives all the
information on
the code
Paste this code after the previous one
' -------------------------------------------------------
' Loop through all the files in the specified folder
' -------------------------------------------------------
Do While OriginalFileName <> ""
' Open the first file with the specified extension (cell C4 (.DBF)).
Workbooks.Open Filename:=OriginalFolderName & OriginalFileName
' Immediately save a file (destination) in the given folder (SaveAsFolderName) with
the same name as the original one and the specified extension (SaveAsExtension).
SaveAsFileName = SaveAsFolderName & Left(OriginalFileName, Len(OriginalFileName) - 4) &
SaveAsExtension
' Define the position of the last column and the last row. So the next part of this code can
scroll this entire range.
With ActiveSheet.Cells
LastCol = .Find("*", [A1], , , xlByColumns, xlPrevious).Column
LastRow = .Find("*", [A1], , , xlByRows, xlPrevious).Row
End With
' Open the destination file you just created (SaveAsFileName).
Open SaveAsFileName For Output As #SaveAsFileNumber
Web-IT Support and Consulting
Step 3.4
Green text gives all
the information on
the code
Paste this code after the previous one
' Loop through all the rows.
For LoopInRows = 1 To LastRow
' Loop through all the columns.
For LoopInCols = 1 To LastCol
' This IF-statement is optional. It's only useful if you intend to import the files afterwards in MS SQL Server.
' This is a predefined conversion to have a correct date format (in this case yyyy-mm-dd).
' First you test if it is a date, next you check if it's not a time. This because you don't want a time to be
converted in a date format (I noticed this is by default done by MS Excel).
If IsDate(ActiveSheet.Cells(LoopInRows, LoopInCols).Value) = True And InStr(ActiveSheet.Cells(LoopInRows,
LoopInCols).Value, ":") = 0 Then
' If the scrolling reached the last column, a line feed and not the given delimiter is needed to start a new line.
If LoopInCols = LastCol Then
Print #SaveAsFileNumber, Year(ActiveSheet.Cells(LoopInRows, LoopInCols).Value) & "-" &
Month(ActiveSheet.Cells(LoopInRows, LoopInCols).Value) & "-" & Day(ActiveSheet.Cells(LoopInRows,
LoopInCols).Value) & vbNewLine;
' If it's not the last column, the delimiter needs to be inserted.
Else
Print #SaveAsFileNumber, Year(ActiveSheet.Cells(LoopInRows, LoopInCols).Value) & "-" &
Month(ActiveSheet.Cells(LoopInRows, LoopInCols).Value) & "-" & Day(ActiveSheet.Cells(LoopInRows,
LoopInCols).Value) & DelimiterSign;
End If
Else
' Same as previous but in case it's not a date.
If LoopInCols = LastCol Then
Print #SaveAsFileNumber, ActiveSheet.Cells(LoopInRows, LoopInCols).Value & vbNewLine;
Else
Print #SaveAsFileNumber, ActiveSheet.Cells(LoopInRows, LoopInCols).Value & DelimiterSign;
End If
End If
Next LoopInCols
Next LoopInRows
Web-IT Support and Consulting
Step 3.5
Green text
gives all the
information on
the code
Paste this code after the previous one
' Close the destination file (SaveAsFileName) after the last insert is done
Close #SaveAsFileNumber
' Move on to the next file
OriginalFileName = Dir()
' Close the source file used for the export
ActiveWindow.Close SaveChanges:=False
Loop
End Sub
End of SUB
Web-IT Support and Consulting
Step 4
Run the macro (module)
Ready to Rock ’n Roll
1
2
3
Web-IT Support and Consulting
Step 5
Check the destination folder and look if all files have been converted
If so, you can now work with these files in MS Excel or use them as
import files into your database
It’s again a perfect solution offered by my team. So proud of you
guys and girls! So what do you want me to add to this…
Nothing?
Hey I’m a wise ass, so just for you to know: The call or croak of a
frog is unique to its species. Frogs create this sound by passing air through
the larynx in the throat. In most calling frogs, the sound is amplified by
one or more vocal sacs, membranes of skin under the throat or on the
corner of the mouth, that distend during the amplification of the call.
Some frog calls are so loud that they can be heard up to a mile away.
 
Web-IT Support and Consulting
One last thing before I let you work…
I am so proud about these 2 kids.
They saw immediately that
Web-IT needed somebody like me
(smart, good looking, brains, ...)
One day the 2 little daughters of the owners were playing with the PC of the old man
They saw a presentation of Web-IT Support and Consulting and they asked what
W,E,B,-,I,T was
My parents explained that it was the name of the company and they started to make
funny noises
Webbit, webbiiiit, webbbi, webbeee and they said it sounded like the sound of a frog
Result?
My name: Webby
My body: a frog
Why is my name is Webby?
Web-IT Support and Consulting
It might seem a bit weird that I take over the entire (and
last) screen.
But it’s my job to end this case study.
I would be glad to give an answer to all your questions
and remarks.
Just call or e-mail me.
Oh yeah, ask for Webby. They’ll know where to find me.
Thanks for your attention and hope to hear you soon.
Web-IT Support and Consulting bvba
Steenhuffelstraat 8, 1861-Wolvertem
E-mail: info@webit-support.com
Phone: +32 (0)2 309 67 76
Mobile: +32 (0)475 59 98 20
GPS: latitude: 50.97395, longitude: 4.30504

Mais conteúdo relacionado

Semelhante a Web-IT Support and Consulting - bulk dBase (DBF) exports via Microsoft Excel VBA code and CSV file structure.

Ejb3 Struts Tutorial En
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial EnAnkur Dongre
 
Ejb3 Struts Tutorial En
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial EnAnkur Dongre
 
Article link httpiveybusinessjournal.compublicationmanaging-.docx
Article link httpiveybusinessjournal.compublicationmanaging-.docxArticle link httpiveybusinessjournal.compublicationmanaging-.docx
Article link httpiveybusinessjournal.compublicationmanaging-.docxfredharris32
 
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...amit kuraria
 
Python Modules, Packages and Libraries
Python Modules, Packages and LibrariesPython Modules, Packages and Libraries
Python Modules, Packages and LibrariesVenugopalavarma Raja
 
[FT-7][snowmantw] How to make a new functional language and make the world be...
[FT-7][snowmantw] How to make a new functional language and make the world be...[FT-7][snowmantw] How to make a new functional language and make the world be...
[FT-7][snowmantw] How to make a new functional language and make the world be...Functional Thursday
 
This is the official tutorial from Oracle.httpdocs.oracle.comj.pdf
This is the official tutorial from Oracle.httpdocs.oracle.comj.pdfThis is the official tutorial from Oracle.httpdocs.oracle.comj.pdf
This is the official tutorial from Oracle.httpdocs.oracle.comj.pdfjillisacebi75827
 
Streams of information - Chicago crystal language monthly meetup
Streams of information - Chicago crystal language monthly meetupStreams of information - Chicago crystal language monthly meetup
Streams of information - Chicago crystal language monthly meetupBrian Cardiff
 
Blocks by Lachs Cox
Blocks by Lachs CoxBlocks by Lachs Cox
Blocks by Lachs Coxlachie
 
A tour on ruby and friends
A tour on ruby and friendsA tour on ruby and friends
A tour on ruby and friends旻琦 潘
 
Using Cassandra with your Web Application
Using Cassandra with your Web ApplicationUsing Cassandra with your Web Application
Using Cassandra with your Web Applicationsupertom
 
Cloud forensics putting the bits back together
Cloud forensics putting the bits back togetherCloud forensics putting the bits back together
Cloud forensics putting the bits back togetherShakacon
 
Adventures on live partitioning
Adventures on live partitioningAdventures on live partitioning
Adventures on live partitioningMatteo Melli
 
Quantitative Methods for Lawyers - Class #14 - R Boot Camp - Part 1 - Profess...
Quantitative Methods for Lawyers - Class #14 - R Boot Camp - Part 1 - Profess...Quantitative Methods for Lawyers - Class #14 - R Boot Camp - Part 1 - Profess...
Quantitative Methods for Lawyers - Class #14 - R Boot Camp - Part 1 - Profess...Daniel Katz
 
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docxINFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docxcarliotwaycave
 
Xtext beyond the defaults - how to tackle performance problems
Xtext beyond the defaults -  how to tackle performance problemsXtext beyond the defaults -  how to tackle performance problems
Xtext beyond the defaults - how to tackle performance problemsHolger Schill
 

Semelhante a Web-IT Support and Consulting - bulk dBase (DBF) exports via Microsoft Excel VBA code and CSV file structure. (20)

Ejb3 Struts Tutorial En
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial En
 
Ejb3 Struts Tutorial En
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial En
 
Well You Ought To Know (WYOTK) FP&A Automation Series
Well You Ought To Know (WYOTK) FP&A Automation SeriesWell You Ought To Know (WYOTK) FP&A Automation Series
Well You Ought To Know (WYOTK) FP&A Automation Series
 
Article link httpiveybusinessjournal.compublicationmanaging-.docx
Article link httpiveybusinessjournal.compublicationmanaging-.docxArticle link httpiveybusinessjournal.compublicationmanaging-.docx
Article link httpiveybusinessjournal.compublicationmanaging-.docx
 
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
 
Python Modules, Packages and Libraries
Python Modules, Packages and LibrariesPython Modules, Packages and Libraries
Python Modules, Packages and Libraries
 
[FT-7][snowmantw] How to make a new functional language and make the world be...
[FT-7][snowmantw] How to make a new functional language and make the world be...[FT-7][snowmantw] How to make a new functional language and make the world be...
[FT-7][snowmantw] How to make a new functional language and make the world be...
 
Ot performance webinar
Ot performance webinarOt performance webinar
Ot performance webinar
 
This is the official tutorial from Oracle.httpdocs.oracle.comj.pdf
This is the official tutorial from Oracle.httpdocs.oracle.comj.pdfThis is the official tutorial from Oracle.httpdocs.oracle.comj.pdf
This is the official tutorial from Oracle.httpdocs.oracle.comj.pdf
 
Python Modules and Libraries
Python Modules and LibrariesPython Modules and Libraries
Python Modules and Libraries
 
Streams of information - Chicago crystal language monthly meetup
Streams of information - Chicago crystal language monthly meetupStreams of information - Chicago crystal language monthly meetup
Streams of information - Chicago crystal language monthly meetup
 
Blocks by Lachs Cox
Blocks by Lachs CoxBlocks by Lachs Cox
Blocks by Lachs Cox
 
A tour on ruby and friends
A tour on ruby and friendsA tour on ruby and friends
A tour on ruby and friends
 
Using Cassandra with your Web Application
Using Cassandra with your Web ApplicationUsing Cassandra with your Web Application
Using Cassandra with your Web Application
 
Cloud forensics putting the bits back together
Cloud forensics putting the bits back togetherCloud forensics putting the bits back together
Cloud forensics putting the bits back together
 
Adventures on live partitioning
Adventures on live partitioningAdventures on live partitioning
Adventures on live partitioning
 
Quantitative Methods for Lawyers - Class #14 - R Boot Camp - Part 1 - Profess...
Quantitative Methods for Lawyers - Class #14 - R Boot Camp - Part 1 - Profess...Quantitative Methods for Lawyers - Class #14 - R Boot Camp - Part 1 - Profess...
Quantitative Methods for Lawyers - Class #14 - R Boot Camp - Part 1 - Profess...
 
Lab 1 Essay
Lab 1 EssayLab 1 Essay
Lab 1 Essay
 
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docxINFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
 
Xtext beyond the defaults - how to tackle performance problems
Xtext beyond the defaults -  how to tackle performance problemsXtext beyond the defaults -  how to tackle performance problems
Xtext beyond the defaults - how to tackle performance problems
 

Mais de Dirk Cludts

Date dimension table - part II
Date dimension table - part IIDate dimension table - part II
Date dimension table - part IIDirk Cludts
 
Date dimension in your data warehouse
Date dimension in your data warehouseDate dimension in your data warehouse
Date dimension in your data warehouseDirk Cludts
 
Web it support and consulting - link many files in ms access
Web it support and consulting - link many files in ms accessWeb it support and consulting - link many files in ms access
Web it support and consulting - link many files in ms accessDirk Cludts
 
Web-IT Support and Consulting - dBase exports
Web-IT Support and Consulting - dBase exportsWeb-IT Support and Consulting - dBase exports
Web-IT Support and Consulting - dBase exportsDirk Cludts
 
Web it support and consulting - case study bi
Web it support and consulting - case study biWeb it support and consulting - case study bi
Web it support and consulting - case study biDirk Cludts
 
Web-IT support and consulting - Case studies LinkedIn
Web-IT support and consulting - Case studies LinkedInWeb-IT support and consulting - Case studies LinkedIn
Web-IT support and consulting - Case studies LinkedInDirk Cludts
 
Web-IT support and consulting - Case studies training
Web-IT support and consulting - Case studies trainingWeb-IT support and consulting - Case studies training
Web-IT support and consulting - Case studies trainingDirk Cludts
 

Mais de Dirk Cludts (7)

Date dimension table - part II
Date dimension table - part IIDate dimension table - part II
Date dimension table - part II
 
Date dimension in your data warehouse
Date dimension in your data warehouseDate dimension in your data warehouse
Date dimension in your data warehouse
 
Web it support and consulting - link many files in ms access
Web it support and consulting - link many files in ms accessWeb it support and consulting - link many files in ms access
Web it support and consulting - link many files in ms access
 
Web-IT Support and Consulting - dBase exports
Web-IT Support and Consulting - dBase exportsWeb-IT Support and Consulting - dBase exports
Web-IT Support and Consulting - dBase exports
 
Web it support and consulting - case study bi
Web it support and consulting - case study biWeb it support and consulting - case study bi
Web it support and consulting - case study bi
 
Web-IT support and consulting - Case studies LinkedIn
Web-IT support and consulting - Case studies LinkedInWeb-IT support and consulting - Case studies LinkedIn
Web-IT support and consulting - Case studies LinkedIn
 
Web-IT support and consulting - Case studies training
Web-IT support and consulting - Case studies trainingWeb-IT support and consulting - Case studies training
Web-IT support and consulting - Case studies training
 

Último

MK KOMUNIKASI DATA (TI)komdat komdat.docx
MK KOMUNIKASI DATA (TI)komdat komdat.docxMK KOMUNIKASI DATA (TI)komdat komdat.docx
MK KOMUNIKASI DATA (TI)komdat komdat.docxUnduhUnggah1
 
How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFAAndrei Kaleshka
 
Heart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis ProjectHeart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis ProjectBoston Institute of Analytics
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxEmmanuel Dauda
 
Predicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdfPredicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdfBoston Institute of Analytics
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort servicejennyeacort
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]📊 Markus Baersch
 
9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home ServiceSapana Sha
 
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝DelhiRS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhijennyeacort
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Jack DiGiovanna
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...Florian Roscheck
 
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一fhwihughh
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptxthyngster
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPramod Kumar Srivastava
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degreeyuu sss
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queensdataanalyticsqueen03
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfgstagge
 
Advanced Machine Learning for Business Professionals
Advanced Machine Learning for Business ProfessionalsAdvanced Machine Learning for Business Professionals
Advanced Machine Learning for Business ProfessionalsVICTOR MAESTRE RAMIREZ
 
RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.natarajan8993
 
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...Boston Institute of Analytics
 

Último (20)

MK KOMUNIKASI DATA (TI)komdat komdat.docx
MK KOMUNIKASI DATA (TI)komdat komdat.docxMK KOMUNIKASI DATA (TI)komdat komdat.docx
MK KOMUNIKASI DATA (TI)komdat komdat.docx
 
How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFA
 
Heart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis ProjectHeart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis Project
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptx
 
Predicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdfPredicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdf
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]
 
9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service
 
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝DelhiRS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
 
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queens
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdf
 
Advanced Machine Learning for Business Professionals
Advanced Machine Learning for Business ProfessionalsAdvanced Machine Learning for Business Professionals
Advanced Machine Learning for Business Professionals
 
RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.
 
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
 

Web-IT Support and Consulting - bulk dBase (DBF) exports via Microsoft Excel VBA code and CSV file structure.

  • 1. Web-IT Support and Consulting Web-IT Support and Consulting A human vision on the digital world
  • 2. Web-IT Support and Consulting Still using dBase? One would be surprised how many dBase databases are still active in companies. But what if you intend to migrate to MS SQL Server or just want to export all these files into a *.CSV format for further use? Not an easy task, lots of effort and really time consuming. That’s why I want to share the next solution with you (download the slide share file to use the copy-paste function). Enjoy reading and for any additional question, just give a ring to my team (info at the last page). Cheeriooo, Webby (that’s me)
  • 3. Web-IT Support and Consulting Why this solution My boss and his (my) team always have creative solutions and like to share them. Fastest way to convert hundreds of dBase files in 1 go Countering the fact that MS Excel doesn’t use the system settings (delimiters) in VBA code (more on this can be found on the web) Solid basis to use the *.CSV files in MS Excel or as bulk import files in MS SQL Server
  • 4. Web-IT Support and Consulting Step 1 Yep, this looks easy to me. Create a new MS Excel file and save it with the option Define a sheet where people can enter the location of their sources and destinations
  • 5. Web-IT Support and Consulting Step 2.1 Hey guys, wait a second. By default the ‘DEVELOPER’ menu is not activated. To do so follow these steps: 1. Click on File >> Options >> Customize Ribbon 2. Select in the right pane the ‘Developer’ tab. 3. Click OK. Create a new macro (module) in the same MS Excel file (that’s why you had to save as a Macro-enabled workbook)
  • 6. Web-IT Support and Consulting Step 2.2 Easy peasy Create a new macro (module) in the same MS Excel file (that’s why you had to save as a Macro-enabled workbook)
  • 7. Web-IT Support and Consulting Step 3.1 Green text gives all the information on the code Paste all the code on the following pages one after the other in the module Window Sub ExportdBaseFiles() ' ------------------------------------------------------- ' Definition of variables ' ------------------------------------------------------- Dim OriginalFolderName As String Dim OriginalFileName As String Dim SaveAsFolderName As String Dim SaveAsFileName As String Dim LastCol As Integer Dim LastRow As Long Dim LoopInRows As Long Dim LoopInCols As Integer Dim SaveAsFileNumber As Integer Dim DelimiterSign As String Dim SaveAsExtension As String ' ------------------------------------------------------- Start of SUB Download the presentation to be able to copy-paste.
  • 8. Web-IT Support and Consulting Step 3.2 Green text gives all the information on the code Paste this code after the previous one ' ------------------------------------------------------- ' Initializing variables ' ------------------------------------------------------- ' Refer as much as possible to cell values so the end-users can define their own sources and destinations. OriginalFolderName = Range("C2").Value SaveAsFolderName = Range("C3").Value OriginalFileName = Dir(OriginalFolderName & Range("C4").Value) SaveAsFileName = "" DelimiterSign = Range("C5").Value SaveAsFileNumber = FreeFile ' FreeFile defines a file number that is not yet used. SaveAsExtension = Range("C6").Value ' -------------------------------------------------------
  • 9. Web-IT Support and Consulting Step 3.3 Green text gives all the information on the code Paste this code after the previous one ' ------------------------------------------------------- ' Loop through all the files in the specified folder ' ------------------------------------------------------- Do While OriginalFileName <> "" ' Open the first file with the specified extension (cell C4 (.DBF)). Workbooks.Open Filename:=OriginalFolderName & OriginalFileName ' Immediately save a file (destination) in the given folder (SaveAsFolderName) with the same name as the original one and the specified extension (SaveAsExtension). SaveAsFileName = SaveAsFolderName & Left(OriginalFileName, Len(OriginalFileName) - 4) & SaveAsExtension ' Define the position of the last column and the last row. So the next part of this code can scroll this entire range. With ActiveSheet.Cells LastCol = .Find("*", [A1], , , xlByColumns, xlPrevious).Column LastRow = .Find("*", [A1], , , xlByRows, xlPrevious).Row End With ' Open the destination file you just created (SaveAsFileName). Open SaveAsFileName For Output As #SaveAsFileNumber
  • 10. Web-IT Support and Consulting Step 3.4 Green text gives all the information on the code Paste this code after the previous one ' Loop through all the rows. For LoopInRows = 1 To LastRow ' Loop through all the columns. For LoopInCols = 1 To LastCol ' This IF-statement is optional. It's only useful if you intend to import the files afterwards in MS SQL Server. ' This is a predefined conversion to have a correct date format (in this case yyyy-mm-dd). ' First you test if it is a date, next you check if it's not a time. This because you don't want a time to be converted in a date format (I noticed this is by default done by MS Excel). If IsDate(ActiveSheet.Cells(LoopInRows, LoopInCols).Value) = True And InStr(ActiveSheet.Cells(LoopInRows, LoopInCols).Value, ":") = 0 Then ' If the scrolling reached the last column, a line feed and not the given delimiter is needed to start a new line. If LoopInCols = LastCol Then Print #SaveAsFileNumber, Year(ActiveSheet.Cells(LoopInRows, LoopInCols).Value) & "-" & Month(ActiveSheet.Cells(LoopInRows, LoopInCols).Value) & "-" & Day(ActiveSheet.Cells(LoopInRows, LoopInCols).Value) & vbNewLine; ' If it's not the last column, the delimiter needs to be inserted. Else Print #SaveAsFileNumber, Year(ActiveSheet.Cells(LoopInRows, LoopInCols).Value) & "-" & Month(ActiveSheet.Cells(LoopInRows, LoopInCols).Value) & "-" & Day(ActiveSheet.Cells(LoopInRows, LoopInCols).Value) & DelimiterSign; End If Else ' Same as previous but in case it's not a date. If LoopInCols = LastCol Then Print #SaveAsFileNumber, ActiveSheet.Cells(LoopInRows, LoopInCols).Value & vbNewLine; Else Print #SaveAsFileNumber, ActiveSheet.Cells(LoopInRows, LoopInCols).Value & DelimiterSign; End If End If Next LoopInCols Next LoopInRows
  • 11. Web-IT Support and Consulting Step 3.5 Green text gives all the information on the code Paste this code after the previous one ' Close the destination file (SaveAsFileName) after the last insert is done Close #SaveAsFileNumber ' Move on to the next file OriginalFileName = Dir() ' Close the source file used for the export ActiveWindow.Close SaveChanges:=False Loop End Sub End of SUB
  • 12. Web-IT Support and Consulting Step 4 Run the macro (module) Ready to Rock ’n Roll 1 2 3
  • 13. Web-IT Support and Consulting Step 5 Check the destination folder and look if all files have been converted If so, you can now work with these files in MS Excel or use them as import files into your database It’s again a perfect solution offered by my team. So proud of you guys and girls! So what do you want me to add to this… Nothing? Hey I’m a wise ass, so just for you to know: The call or croak of a frog is unique to its species. Frogs create this sound by passing air through the larynx in the throat. In most calling frogs, the sound is amplified by one or more vocal sacs, membranes of skin under the throat or on the corner of the mouth, that distend during the amplification of the call. Some frog calls are so loud that they can be heard up to a mile away.  
  • 14. Web-IT Support and Consulting One last thing before I let you work… I am so proud about these 2 kids. They saw immediately that Web-IT needed somebody like me (smart, good looking, brains, ...) One day the 2 little daughters of the owners were playing with the PC of the old man They saw a presentation of Web-IT Support and Consulting and they asked what W,E,B,-,I,T was My parents explained that it was the name of the company and they started to make funny noises Webbit, webbiiiit, webbbi, webbeee and they said it sounded like the sound of a frog Result? My name: Webby My body: a frog Why is my name is Webby?
  • 15. Web-IT Support and Consulting It might seem a bit weird that I take over the entire (and last) screen. But it’s my job to end this case study. I would be glad to give an answer to all your questions and remarks. Just call or e-mail me. Oh yeah, ask for Webby. They’ll know where to find me. Thanks for your attention and hope to hear you soon. Web-IT Support and Consulting bvba Steenhuffelstraat 8, 1861-Wolvertem E-mail: info@webit-support.com Phone: +32 (0)2 309 67 76 Mobile: +32 (0)475 59 98 20 GPS: latitude: 50.97395, longitude: 4.30504