473,326 Members | 2,127 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,326 software developers and data experts.

Access/Excel changing current directory

I have an Access database/procedure that exports data to an Excel
spreadsheet and opens that spreadsheet using automation

I need to change the current directory/drive in Excel to be the same as
that of the spreadsheet I've created so that the user is in the correct
place in Excel when the Access procedure finishes.

I know of ChDrive() and ChDir() but how do I manipulate these functions
in my Excel Application object from Access?

------
Sean

"If at first you don't succeed, go to sleep"

*** Sent via Developersdex http://www.developersdex.com ***
Apr 24 '06 #1
1 2778

"Sean Howard" <se*********@TimeaIntLtd.hu> wrote in message
news:Sz*************@news.uswest.net...
I have an Access database/procedure that exports data to an Excel
spreadsheet and opens that spreadsheet using automation

I need to change the current directory/drive in Excel to be the same as
that of the spreadsheet I've created so that the user is in the correct
place in Excel when the Access procedure finishes.

I know of ChDrive() and ChDir() but how do I manipulate these functions
in my Excel Application object from Access?

------
Sean

"If at first you don't succeed, go to sleep"

*** Sent via Developersdex http://www.developersdex.com ***


Don't know if it is the best way but here is one way:

objExcelApp.ExecuteExcel4Macro "DIRECTORY(""C:\My Folder Name"")"

ExecuteExcel4Macro can come in very handy sometimes because Excel 4 macro
commands can do things that can not be done in "improved" later versions of
Excel using VBA.

- Joe
Apr 24 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Paul | last post by:
I was wondering if anyone has had an issue where using vba code to read an excel file and import the data into an access table some records are not imported from the excel file. It seems looking at...
1
by: gale | last post by:
I have an Access 2003 project. I need for users to be able to run a report and copy the report in Excel format to a web server. The problem is, they do not have write access to the web server. I...
3
by: Alur | last post by:
Changing the current directory with the help of dialog window(MFC app) We can change directory with the help of the following code: CFileDialog m_ldFile(TRUE);...
9
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
6
by: WhiteWizard | last post by:
I have been chasing what should be a simple problem for a day or two now. I have done the google thing, but all the problems listed (at least so far) have been problems with web applications. ...
1
by: thadson | last post by:
Hi, I'm trying to import specific cells from MS Excel 2000 spreadsheets to MS Access 2000 tables then move the spreadsheets to a different directory. I'm very new to this and I'm having trouble...
0
by: wankhusairi | last post by:
hallo sir .. i am still new on using vb and i have tried to load an excel using a visual basic interface.. but if i wanted to plot my excel data what should i do.. must i cahnge my program on loading...
16
by: Phil Stanton | last post by:
I have a form with a button which is supposed to open an Excel file (With lots of Macros /VBA) in it. The Excel file gets it's data from the Access program Here is the code Private Sub...
6
by: provor | last post by:
Hello, I have the following code that I am using when a user presses a button to import an excel file into a table. The code is hard coded to point to the correct table. This works great for this...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
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 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.