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

access 2003 export to Excel 2003 worksheets

Hello,

I am trying to export several Access 2003 select queries to Excel 2003 using an Access macro. I'm using the macro command "TransferSpreadsheet" to export the queries. This going quit well, but I've one problem.
The first problem is that in Excel apostrophes ('), carets (^), quotation marks ("), or backslashes (\) appear in the formula bar but not in the cells, like it does when you import in Excel from Lotus. When I use the command "CmD.Output" to Excel this doesn't appear. A little problem, but quit annoying because the characters are taken over by a copy and paste action.

The code I use is:
--------------------
Function Mcr_Export_ScanControlDetailTypetoExcel()
On Error GoTo Mcr_Export_ScanControlDetailTypetoExcel_Err

Dim strdate As String

strdate = Format$(Date, "yyyymmdd")

Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FileExists("D:\My Documents\Desktop\Scancontrol_DetailType-" & strdate & ".xls") Then
filesys.DeleteFile "D:\My Documents\Desktop\Scancontrol_DetailType-" & strdate & ".xls"
End If

Set appExcel = CreateObject("Excel.Application")

appExcel.Visible = True
appExcel.Application.WindowState = xlMaximized
appExcel.ScreenUpdating = True

' Exporteren 'Report Customer Information' naar Excel
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Mutation_AST_Laptop", "D:\My Documents\Desktop\Scancontrol_DetailType-" & strdate & ".xls", True, ""
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Mutation_AST_Workstation", "D:\My Documents\Desktop\Scancontrol_DetailType-" & strdate & ".xls", True, ""
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "New_AST_Laptop", "D:\My Documents\Desktop\Scancontrol_DetailType-" & strdate & ".xls", True, ""
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "New_AST_Workstation", "D:\My Documents\Desktop\Scancontrol_DetailType-" & strdate & ".xls", True, ""

appExcel.Workbooks.Open "D:\My Documents\Desktop\Scancontrol_DetailType-" & strdate & ".xls"
Excel_Opmaak

appExcel.Sheets("Mutation_AST_Workstation").Select
Excel_Opmaak

appExcel.Sheets("New_AST_Laptop").Select
Excel_Opmaak

appExcel.Sheets("New_AST_Workstation").Select
Excel_Opmaak

appExcel.Sheets("Mutation_AST_Laptop").Select

Mcr_Export_ScanControlDetailTypetoExcel_Exit:
Exit Function

Mcr_Export_ScanControlDetailTypetoExcel_Err:
MsgBox Error$
Resume Mcr_Export_ScanControlDetailTypetoExcel_Exit

End Function

------------------
Has anyone a suggestion?

With kind regards,

Sander van Ee
Jul 5 '07 #1
0 2628

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

Similar topics

3
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...
4
by: DFS | last post by:
" has detected corruption in this file. To try to repair the corruption, first make a backup copy of the file. Then, on the Tools menu, point to Database Utilities and click Compact and Repair...
4
by: Anthony Cuttitta Jr. | last post by:
I'm working on some procedures where Access queries are exported to Excel, and then later on, those same workbooks are openned, and I need to target a specific original sheet. Sometimes there will...
1
by: cybertof | last post by:
Hello, Is there a way to connect (through automation) a c# application to a running Excel 2003 instance on a specific workbook ? In the past, i used to use GetObject(...) function in VB6. ...
6
by: Elena | last post by:
I'm trying to export data to an Excel worksheet. I can export the data in the cell values perfectly. I need the code to change a header and footer for the worksheet, not for the columns. Is...
3
by: rlntemp-gng | last post by:
RE: Access 2003/Excel 2003 Problem: After I close the Access application completely, I go out to the Task Manager and there is an Excel.exe object still sitting out there. My Access...
7
by: semijoyful | last post by:
OS: Win XP SP2 Access version: 2003 Excel version: 2003 I am new at this, as I am sure you have gathered from this post title:) I am working on a form where users can input data in Access and...
1
by: CoolFactor | last post by:
MY CODE IS NEAR THE BOTTOM I want to export this Access query into Excel using a command button on an Access form in the following way I describe below. Below you will find the simple query I am...
1
by: DennisBetten | last post by:
First of all, I need to give some credit to Mahesh Chand for providing me with an excellent basis to export data to excel. What does this code do: As the title says, this code is capable of...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
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...
0
marktang
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,...
0
Oralloy
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 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.