I am having quite the unique problem trying to Export to Excel and I need ot find a solution within 3 hours. -- PLEASE HELP!
The system exports a file from the application that the users can make changes to and then reimport. But now matter what format I specify to export to, when I open the exported files, it says they are in Excel 5.0.
I originally used the code: - DoCmd.OutputTo acTable, "PRC_REPRT", "MicrosoftExcelBiff8(*.xls)", EXP_FLDR & "Processed Records - " & DATE_CODE & ".xls", False, "", 0
Doing a little research, I found a lot of people said that the "OutputTo" causes the problem and that I should use the "Transferspreadsheet" Command.
Now the code looks like this: -
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "ERR_REPRT", EXP_FLDR & "Error Records - " & DATE_CODE & ".xls", False, , 0
The file exports in the right format, but it left me with a new problem. When I used the OutputTo command, It output with the Caption titles and they were formatted in Grey. It looked nice and i built my reimport mappings based on those titles. To change it now would be a huge undertaking.
So my question is, can I get the transferspreadsheet method to output the caption names not the actual field names (i.e "Serial Code" instead of "SERL_CD")
Thanks to anyone with some ideas or helpful hints!
3 4302
The simple answer now. This method is used to export raw data, its quick neat but ineffictive for what you want.
What you want is something like this -
Public objapp As Excel.Application
-
Public objbook As Excel.Workbook
-
Public objsheet As Excel.Worksheet
-
-
Set objbook = Workbooks.Add(Template:=CurrentProject.Path & "\Reservation List.xlt") 'Your excel spreadsheet file goes here
-
Set objapp = objbook.Parent
-
Set objsheet = objbook.Worksheets("sheet1") 'Name of sheet you want to export to
-
objbook.Windows(1).Visible = True
-
sSQL = "SELECT tbl_z_tempDID.DID, tbl_Order_Number_Arch_sub.ISDN_ckt_Id, tbl_Order_Number_Arch_sub.VerizonBTN, tbl_Order_Number_Arch_sub.SDP_Address, [tbl_Order_Number_Arch_sub]![Circuit_ID1] & ' - ' & Right([tbl_Order_Number_Arch_sub]![Circuit_ID2],4) AS MCI_CircuitID, tbl_Order_Number_Arch_sub.[MCI BTN], tbl_Order_Number_Arch_sub.Switch, tbl_Order_Number_Arch_sub.Comments" _
-
& " FROM tbl_Order_Number_Arch_sub INNER JOIN tbl_z_tempDID ON tbl_Order_Number_Arch_sub.AutoNumber = tbl_z_tempDID.DIDReference" _
-
& " WHERE (((tbl_Order_Number_Arch_sub.Carrier_OrderNumber)='" & Carrier_OrderNumber & "'))" _
-
& " ORDER BY tbl_z_tempDID.DID"
-
Set rs = db.OpenRecordset(sSQL)
-
-
With objsheet
-
.Select
-
.Range("B3") = Carrier_OrderNumber
-
.Range("B4") = OrderDate
-
.Range("B5") = rs!Did
-
If lbl_description.Caption = " DID" Then
-
.Range("B6") = "N/A"
-
.Range("B7") = "N/A"
-
.Range("B8") = "N/A"
-
Else
-
.Range("B6") = Forms!frm_Order_Req!frm_Order_Req_Address!Address
-
.Range("B7") = SiteReference
-
.Range("B8") = CrossAtSite
-
-
End If
-
.Range("B10") = RSD
-
.Range("A13").CopyFromRecordset rs
-
.Range("B13").CopyFromRecordset rs!SDN_ckt_Id
-
End With
-
'.Range("E1") = Now()
-
objapp.Visible = True
-
With this one you create a template with all the nice trimmings you want and using the with function you can export to specific cells in excel
I am having quite the unique problem trying to Export to Excel and I need ot find a solution within 3 hours. -- PLEASE HELP!
The system exports a file from the application that the users can make changes to and then reimport. But now matter what format I specify to export to, when I open the exported files, it says they are in Excel 5.0.
I originally used the code: - DoCmd.OutputTo acTable, "PRC_REPRT", "MicrosoftExcelBiff8(*.xls)", EXP_FLDR & "Processed Records - " & DATE_CODE & ".xls", False, "", 0
Doing a little research, I found a lot of people said that the "OutputTo" causes the problem and that I should use the "Transferspreadsheet" Command.
Now the code looks like this: -
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "ERR_REPRT", EXP_FLDR & "Error Records - " & DATE_CODE & ".xls", False, , 0
The file exports in the right format, but it left me with a new problem. When I used the OutputTo command, It output with the Caption titles and they were formatted in Grey. It looked nice and i built my reimport mappings based on those titles. To change it now would be a huge undertaking.
So my question is, can I get the transferspreadsheet method to output the caption names not the actual field names (i.e "Serial Code" instead of "SERL_CD")
Thanks to anyone with some ideas or helpful hints!
Is there a simpler way than this? I have over 110 columns I would have to map.
If this is the only way, I will do it, but I was hoping there might be an easier way...
It is too late ,But I suggest to use an c# excel component, I use it from last year, there may be a easier way to you.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: sridevi |
last post by:
Hello
How to export data from ms-access database to excel worksheet using ASP.
mainly i need to export data to multiple worksheets. it is very urgent to
us.
i have a sample code which works...
|
by: D |
last post by:
I've created a report with many subreports of aggregate data. I want my
client to be able to export this data to Excel to make her charts, etc. Only
one problem: one of the fields is a "SchoolYear"...
|
by: G |
last post by:
When I export data from access to excel by with "export" or "Analyze
with" I seem to loose parts of some fields (long text strings). Is
there a way to export it all to excel?
Thanks
G
|
by: Kenneth |
last post by:
How do I remove the limitation in Access that deny me from exporting 24000
rows and 17 columns (in a query) into Excel?
Kenneth
|
by: NancyA |
last post by:
I am using the following code to write data from a datagrid to an Excel file:
Dim tw As New System.IO.StringWriter
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
dg.RenderControl(hw)...
|
by: Mustufa Baig |
last post by:
Hi everybody,
I have an ASP.NET website where clients can view their monthly billings by
selecting different options. One of the option is the way they want to see
the report i.e. whether they...
|
by: Mustufa Baig |
last post by:
I have an ASP.NET website where I am showing off crystal reports to users by
exporting them to pdf format. Following is the code:
----------------
1 Private Sub ExportReport()
2 Dim oStream...
|
by: bienwell |
last post by:
Hi,
I have a question about exporting data from datagrid control into Excel file
in ASP.NET. On my Web page, I have a linkbutton "Export data". This link
will call a Sub Function to perform...
|
by: Snozz |
last post by:
The short of it:
If you needed to import a CSV file of a certain structure on a regular
basis(say 32 csv files, each to one a table in 32 databases), what
would be your first instinct on how to...
|
by: Tom |
last post by:
I have a gridview on all of my web pages in my web app and they all export
to excel. I have one page where the gridview is binding to a datatable that
i created and only the first column is...
|
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...
|
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...
|
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...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |