Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

export an access table into excel using vbscript

Posted on 2006-07-12
4
1,203 Views
Last Modified: 2008-01-09
Hi

I have a protected database which does not let me add modules, macros, queries or specifications to it.
I need to export the table from the database called "maintable" to excel.

Because i cant add a specification i can't use DoCmd.TransferText, so used DoCmd.TransferSpreadsheet

I know the following code works if run from a module ....

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "maintable", "C:\test.xls", True

but when i put it into a vbscript then it doesnt work.
I get error saying ...
"The microsoft jet database engine could not find the object 'C:\test.xls'. Make sure the object exists and that you spell its name and the path name correctly
error code 800A0BC3

I cant figure out why this is happening. Any ideas?
0
Comment
Question by:Sailo100
  • 3
4 Comments
 
LVL 11

Expert Comment

by:pootle_flump
ID: 17090234
Hi

What's your script?
0
 
LVL 11

Accepted Solution

by:
pootle_flump earned 250 total points
ID: 17090369
This code works fine:

SET oAcc = CREATEOBJECT("Access.Application")

oAcc.OpenCurrentDatabase "RemoteDB.mdb"

oAcc.DoCmd.TransferSpreadsheet 1, 8, "MyTable", "C:\test.xls", True ' acExport = 1, acSpreadsheetTypeExcel9 = 8
0
 

Author Comment

by:Sailo100
ID: 17090990
Hi

that works great thanks, one more question if was importing data into access then would
acImport = 2 ??
0
 
LVL 11

Expert Comment

by:pootle_flump
ID: 17092329
Easiest way to check - debug the constants in the immediate window of VB\ VBA

?acImport
 0
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question