Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

(80% Discount Ends Soon!)

Export Data from Excel

I am trying to export Excel data into SQL server.
How do I export Data from Multiple Worksheets into one Worksheet or is there a way to export data from mutiple sheets directly into a single table in SQL Server.
Help would be Much appreciated.


Is it possible to export data from Oracle to Excel with VBA.? Is there any macro or something?


I have been trying to get IE to export a database table to EXCEL. It will
not do it.

I can right click on the body of the data and say EXPORT to EXCEL - but it
won't export or go to the clipboard.

How can I get it to do that?

Help (again ) please:
My original posting concerned splitting a date/time into 2 fields where
my issue was with the text to column wizard. The solution a user posted
worked- I copied the orig col into a new one and formatted the 1st as a
date, the second, as a time.

When I imported the data into FileMaker, the date transferred
correctly, but the time looks like this:-4293:0':.- or this:

I have changed the field definition types in FM to all varieties (date,
time, number, text) but nothing works, so I am left to believe it is
something weird on the excel side?? (I created a macro to do all the
insert new col, copy, format cell, etc. and ran it on the data before
importing to FM.)


I need to export an Excel spreadsheet to a fixed width text file--it cannot
be tab- or comma-delimited. I've found that Access can do this correctly for
me and will let me control the export process. However, my problem is that
my company does not support Access so I have to find another method of
exporting, and about the only tool I have available is Excel. No matter what
I seem to do, it saves it in a tab-delimited format.

To try and force it as a fixed width file, I change the font to Courier New,
then I save it as a MS-DOS .txt file. Can someone suggest something that may

I want to transfer stock/option information from an Excel spreadsheet to
TurboTax. MS Money supposedly can export a .txf (tax exchange format) file
to import the information to TurboTzx. Format specification is available at
http://www.turbotax.com/txf/TXF041.html Is there anyway to create a
similiar file from an Excel spreadsheet?

Does anybody have a VBA script that would get us started on exporting data
from Excel to a file?

We want to export it as Fixed Length ASCII

And put in a CRLF after certain cells to indicate 'end of record'

Thanks for any help.


Hello all. We have the need to export a file from excel to a semicolon
delimited text file. Is there a way to do this from Excel directly? If
not, does anyone have any other suggestions? TIA for your help.

Does anyone know how to export data from an .xls file to a csv, and encode
all text fields with double quotes > ""?
I can use "save as" to get a csv file, but then the text does not have
double quotes.
any ideas?

Does any know of any means to change the delimiter when saving as text? I
want to use | (pipes) instead of TAB or CSV. I also want to get rid of

I really wish Excel would behave like Access in this regard. Anyone?



Have an excel spreadsheet that has a record length of over a 1000+
characters. Export it as a 'prn' extension, but when I look at the prn file
I find that it has been broken up into 3 segments. This is not a problem
with wordwrap as that is turned off. I have even verified in multiple
editors that this file has been segmented out by Excel. Problem is I don't
know why it is or how to change Excel it so it will export the entire record

I want to create a file with fixed length records (lines). The fields
(columns) have defined lengths. When I export the file, it should be in a
flat text format, there should be no spacing between columns of data, and the
total line length should be exactly what I want.

How do I do this? What format should I export the data into?

My export option is disabled under data/xml tab. What is the exact feature I
need to install to get this export xml option. I didn't install all the
option during excel installation. Which specific install tab are required
during excel installation?


I am on a Mac platform and use Entourage. It really isn't as comprehensive as
we need. We need to view jobs in progress in a list and calendar format. If
there isn't a export to calendar function, is there an extension available
that works with excel and entourage?

I am new to Excel and have newly created a roster for a group I am part of.
In this roster, I have names, addressess and emails. I now want to send the
whole group an email. Is there a way to take the email list Ive created and
export it to yahoo? Like a quick way to take this long list of emails (about
100) and easily send them to my yahoo 'compose email' section?
THANK YOU. I need to email today, so appreciate quick replies.

I need to export or copy a chart from excel, and make a high resolution tiff
or jpg file for a publisher. does anyone know how to do this. copying and
pasting a chart yields only a 900x600 jpg.


is there a way to export the results of the 'find' query to a notepad or a
new excel sheet)

I'd like to create an Outlook email distribution list using email addresses
that are listed in one column of an Excel spreadsheet. What is the process?


hello all,

I am simply trying to save a sheet as a text file with the column contents saved as a simple long string of data, regardless of content.

Ex. If my columns were this: (underscores represents columns, the pipes and ampersands are actual cell content).


I would want the text file to read:


None of the "Save As" choices allow this. All end up with at least tab's separating the original cell contents. Also tried changing the delimiter in the control panel, but NULL is not an allowed choice. And opening the csv in any text editor still has tabs as separators anyway.


Hi all,

I am importing/exporting calendar data between my Outlook calendar and an Excel (.csv) file. I would like to automate this process with macros, ideally run from Excel.

The importing/exporting function is in Outlook. When I record a macro in Excel, it stops recording when I switch to Outlook. Outlook has macro functionality but no record option.

Can anyone offer a suggestion or provide code that will enable this?

Export Process
File > Import/Export
Choose an action to perform: Export to file
Create a file of type: Comma Separated Values (Windows)
Select folder to export from: Calendar
Save exported file as: C:\Documents and Settings\Robert\Desktop\CalendarImport3.csv
Replace Existing file?: Yes
Set Date Range 1/2/2008 and 30/12/2010

Import Process
File > Import/Export
Choose an action to perform: Import from another program or file
Select file type to import from: Comma Separated Values (Windows)
File to import: C:\Documents and Settings\Robert\Desktop\CalendarImport3.csv
Options: Replace duplicates with items imported
Select destination folder: Calendar

The automation is complicated by the need to save and close the excel file prior to importing or exporting to/from it.

Happy to elaborate further if required.

Thank you in advance for any assistance.




New boy here!

My partner works in payroll in the UK and she regularly needs to export from client received .xls files which contain UK Bank sort codes in the format NN-NN-NN (eg 11-12-46 or similar) Despite formating these fields as text when she converts (saves as) to .csv (required for input to her payroll software) the field is displayed as a date in some cases. So for example 20-42-00 would be OK when converted to .csv but 01-11-56 would be displayed as a date!

I think it must be in the number formatting but I can't work it out.

Has anyone got any ideas for this and apologies if this has been asked before

Best regards,


hi i know this is not a publisher forum but does anyone know where i can get info on how to export to publisher from excel, i tried doing a google search but i just get results showing how to imort into excel

Hi All,

Access and Excel 2003.

Is there a way by any chance to export data from Access to Excel, to a specific template that formats the fields better?

I know how to export data to excel, but the Time field comes up as "00-JAn-00" for all records. Also, some of the State and Research accounts aren't show because the column isnt wide enough and I have to fix that to see all of the data. There is also a couple other small format issues.

So I'm wondering if its possible to set something up like that for excel to eliminate these formatting issues because I need export to excel on a daily basis??

Thank you in advance

Check out www.youtube.com/mycsula for our newly completed series of online SPSS (now IBM Statistics) video tutorials.

Learn how to: define variables, import/export data to SPSS, enter data, run a paired samples t test, perform frequency analysis, use scripting and syntax files, create and edit charts and graphs, and much more.

Training modules cover a wide range of topics aimed at beginners to more advanced users. All videos include examples and instructions to help you with whatever area of research or analysis you are working on.

You can find these videos at mycsula. Check them out and subscribe to our channel today!

The ITS Online Training team

I'm using Excel 2010 on Win 7 64-bit and have some spreadsheets I need to export to XML via a map (which I've done in the past in Excel 2003 and didn't imagine there'd be a problem with!).

The XML mapping functionality seems buried now - but I found instructions (via help), which are also at http://office.microsoft.com/en-gb/ex...010342365.aspx - these specify to install the Excel 2003 XML Tools Add-in.

When follow the instructions, adding the XmlTools.xla add in fails with:
Compile error
The code in this project must be updated for use on 64-bit systems [...]

I then tried introducing PtrSafe and LongPtr as described at http://msdn.microsoft.com/en-us/library/ee691831.aspx (which only required one signature to change).

However, I when I re-added the add-in it showed a compilation error again - this time seemingly re. not recognising DomDocument50 - but I couldn't add a reference since the Reference option was disabled. Annoyingly, I can't recreate that compilation error any more - but the Add In is not installed.

Has anyone found a way to get XML export working on Windows 2010 64-bit - or do I need to uninstall and install 32-bit??

All the best,


Hi. I have data entered on excel - which I sort by date. I want the entries that are 10 days overdue to be exported to a seperate excel spreadsheet - lets call it sheet2.

Is it possible that something like this can be setup to happen automatically?

If so, how do I go about it?

I need to save my Excel charts in the eps format. Unfortunately, unlike other
statistical software I use, Excel doesn't seem to offer any "export" option.
Any clue?
Thanks in advance for your help!

Hi all,
I have an xls sheet containing formula (sql.request). After running the
macros i get all the values in xls. how can save as this file to reflect only
the values keeeping the same format like borders colors etc.
thanks in advance.


I'm trying to export data to a new Excel Sheet as an application. And I am
using the following VBScript sub:

Sub print2(controlID)

dim sButtonClicked, sHTML, pos, sButtonHTML, oExcel,
oBook, Elements, tblTOExport

sButtonClicked = controlID & "_hlkExportTOExcel"

Set Elements = document.all.tags("table")

FOR i=0 TO Elements.length -1

pos = InStr(Elements.Item(i).innerHTML, sButtonClicked)

if pos > 0 then

tblTOExport = Elements.Item(i).Id

Exit For

end if


sHTML = document.all.item(tblTOExport).outerHTML

sButtonHTML = document.all.item(sButtonClicked).outerHTML

sHTML = Replace(sHTML, sButtonHTML, " ")

set oExcel = createobject("Excel.application")

set oBook = oExcel.Workbooks.Add

oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML


oExcel.Visible = True

oExcel.UserControl = True

End Sub

I've two problems :

1) In the formed sheet I cannot see Turkish characters correctly. I'm losing
actual letters, is there a need to set the encoding / language to Turkish, if
there is how can I do that?

2) I want to remove the Hyperlinks in the sheet but when I use
WorkSheet.Hyperlinks.Delete I'm also losing the formatting.

Any help??

I export EXCEL file to CSV at EXCEL XP Chinese versions. If the cell content
is ¡°filed_name¡±, at CSV file change to ¡°¡±¡°filed_name¡±¡±¡±, both sides
have excrescent double quotation marks. If the cell content is filed_name,
at CSV file same no any marks.

How can export to CSV no excrescent double quotation marks?

I need to export a CSV file from an excel sheet with Window Read-Only
attributes (ie. when I right-click on the CSV file from folder view, I need
the Read-Only box checked).

Is there a way to do this with an Excel Marco?

My current code which does not do the functionality described above, is as
ActiveWorkbook.SaveAs "C:\Test\" + Filenamer, xlCSV, , password, True

Even if this code worked, it is read-only in the EXCEL sense right? I need
to be able to protect the contents even if I open the CSV file with Notepad
or Word.

Sounds simple but this is proving a headache for me. I'm looking for any
smnippest of code out there that can handle the following.

In column A I have the date an email should be sent.
In Column B I have the email address to which the email is to be sent.
In Column C I have the subject of the email
In Column D I have the body of the email.
In Column E I have the name of the person sending the email.

The code I'm looking for needs to work like this.

If I click on any cell in column A (on any date), nothing must happen,
unless the date is 'today'. If the datre is today this will trigger the data
in columns b,c,d,e to be entered into an email launched from Outlook in the
roder highlighted below.

If there are any clever boffins out there please help me...


I have a database in Excle I would like to export to Outlook. How do I do
this. It's telling me to drag the Value from one column to the next, but
there is no value? Help?

I have an excel workbook containing many sheets, of which I wish to export
the data residing on one worksheet only. I would like to know how to do 2
1) export the data into an email so that it appears as flat text, not an
embedded picture, so that I am able to have a robot scrape the data to go
into an HTML ODBC. There will be approx 6 columns by 60 lines and the
workbook has many macros embedded in it.
2) export the data directly into an HTML ODBC
I am not a developer, but asking the questions for one, so appreciate layman
terms if possible, but happy to accept any and all help.

How do I export comments into another excel column as cell content? I already
know that I can copy and paste comments from one column to another, but they
still move as comments. I really need to export the text within the comments
onto another column in order to avoid the tedious job of copying and pasting
each individual comment. Thanks for your help!

I'm looking for an example VBA Code to transfer data from Excel to MS Access
2000. The issue is that the spreadsheet contains more then 100 hundred named
cells which needs to be transferred to the corresponding Field Name in MS
Access 2000. I'm not a beginner programmer but i don't want to code all the
separate named cells into MS Access so i'm looking for some smart code to do

Does anyone know wehere i can find some example VBA code to accomplish this.

Thank you in advance

Peter Brom

I want to create a record within an export spreadsheet, export this to
another file(not xls) and retain fixed length fields in the exported file.
Does anybody know how this can be achieved?

Hi Guy's
I need to automate a file export to CSV. i want to export a table called NotePadOutput and save to a csv on my desktop.

I have searched Google but can not find anything that works???

Any help would be great?


Hello All,

I am trying to figure out why there are extra in cells in a worksheet connected to a Sharepoiint list. The lines do not show in the sharepioint list or in dataview, and a cut and paste as plain text does not solve the issue. I appreciate any guidance.

I have a macro that creates a pdf in a specific file. Works fine. Problem is that if a file with that name already exists it just overwrites it.

I want it to prompt me and ask if I want to overwrite it.

I have tried application.displayalerts= True but this doesn't seem to work.

Any assistance gratly appreciated.

Code is:


Sub pdfsave()

pdfname = Range("A1").Value

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="c:\Users\Gordon.METCAST\Documents\Metcast\" & pdfname, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _

End Sub


I have a series of pivot tables in a workbook that all like to a very large data sheet that is formula driven in this file. There are other users that require use of the tables and part of the data, but not the whole file. I am trying to find a way that I can export the pivot tables and the data source (converting it to values instead of the formulas) quickly into a new workbook after each refresh.

I am currently using the vba code to transfer the data table:


Set newwb =workbooks.add
For i = 15 to 16
Sheets(i).Copy after:=newwb.Sheets(1)
Range("A1", Cells.SpecialCells(xlCellTypeLastCell)).Value = Range("A1", Cells.SpecialCells(xlCellTypeLastCell)).Value
next i

However, it does not transfer as values, all the formulas stay in place, and it is driving the size of my file quite high.

Any assitance that could be provided would be very helpful.


I'm terrible with creating macros, so I figured I'll ask you wizards for help. The actual file what I'm using is about 4mb, so I'll try to explain without uploading it, hope this is ok!

I have a NHL player data .xlsx, from where I'd need to export players info to separate text-files. I have one cell in each row containing all the needed info from the specific row (e.g. =A1&CHAR(10)&B1&CHAR(10)&...ect). So I would also need the macro to understand those line changes for the text file.

The cells I'd like to export are in BA4:BA934 and I'd like each text file named with the player name in cells J4:J934. Basically this would save me doing 1000 files separately, so any help is really appreciated!

I'm using the code below to export and save a range (yes, it's a large range!) to an image file. Is there a way to get a higher resolution image using this method?Or is it a limitation of how CopyPicture works with a chart? Or an issue with the size of my range? Gif was no better, and trying a bitmap ended up with a ~200mb image file! The JPG images are only about 40k each. I also tried changing the size of the chart object, but that seems to just stretch the image.

Also, while we're here, I occasionally get an error raised on the line that I highlighted below, which is why I have the error handler looping back to try it again. It will run fine after a couple repeated passes. Any ideas on how to fix that? I tried adding a wait time of up to 5 seconds just before that line, but that didn't seem to help


Sub Export_Range_Image()

' =========================================
' Code to save selected Excel Range as Image
' =========================================

Dim oRange As Range
Dim oCht As Chart
Dim oImg As Picture
Dim nowTime As String
Dim tryagainloop As Integer
Dim ShTemp As Worksheet

Application.ScreenUpdating = False

Set oRange = ActiveSheet.Range("A1:TD256")

Set ShTemp = Worksheets.Add
ActiveChart.location Whe =xlLocationAsObject, Name:=ShTemp.Name
Set oCht = ActiveChart

On Error GoTo TryAgain


 oRange.CopyPicture xlScreen, xlPicture 


On Error Resume Next
MkDir ThisWorkbook.Path & "\Saved_Images"

oCht.Export Filename:=ThisWorkbook.Path & "\Saved_Images\" & nowDate & " - " & VisTitle & ".jpg", Filtername:="JPG"

Application.DisplayAlerts = False
Application.DisplayAlerts = True
Application.ScreenUpdating = True

End Sub

I am looking for a way to export bookmarks in a pdf into an Excel spreadsheet. Is this something that can be controlled using vba in Excel or do I have to look for another application outside of Excel. Any info is much appreciated.


Does anyone know how to export several lists from sharepoint to excel? Currently I export one at a time via the "Export to spreadsheet" function.

Hello All,

I need to export data from excel to a .dat file. This DAT file is an input to another application and the exported data (the numbers) has to be in specific locations so the syntax is not disturbed . Please see attached .txt file for clarity.

Is it possible that only the numbers are exported from excel into this file at appropriate places, if not how do I write a code in excel to export the entire data including the syntax to .txt or .dat file.

Appreciate your help.

Morning all, just joined as can not find the answer to a question I have searched for hours to try and solve. I have done this in the past but can not find the original file, or page showing how to do it.

All I want is a simple way to export named charts from within vba, the best guess I could come up with was this:

Sub Export()

With ActiveChart
ActiveChart.Export "C:\MAPBOOK_OUTPUTS\ChartName.png"

End Sub

Thanks in advance for any help!

I have 2 versions of the same spreadsheet from a 3rd party.

The visual changes are easy to see but I need to check if there are code changes.

The logicical process seems to be to export all code from each app to a text file and the run the 2 text files through a file compare program.

Can this be done, please?


And all of my data is not coming over into excel, due to the row height limitations in excel. Access seems to have more flexibility. I need to work this schedule in excel, any ideads how to change the row height or to have all my data export correctly from access. thanks