?
Solved

export an access table into excel using vbscript

Posted on 2006-07-12
4
Medium Priority
?
1,385 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
[X]
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
  • 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 1000 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

771 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