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

Redmoving a spreadsheet and replaicing it through Access

Hi:

I know that there is a "kill" command, which will remove files from my system, and that it
can be executed through Access.

Can someone tell me the form of the command to, say, remove a file with the path:
"C:/ipt/timesheets/passover.xls"
I would be executing it through a macro using ther "run code" function.

Thanks a lot

JOhn Baker

Jan 11 '06 #1
5 1370
Red
Kill is used to delete files, RmDir is used to delete directories

~Red

Jan 11 '06 #2
I !!!think!!! you will have to create a Procedure in a Standard Module
to do this, eg.

Public Function DeleteFile(ByVal FilePath As String)
Kill FilePath
End Function

Your Run Code Macro then will have an argument (Function Name):
DeleteFile ("C:/ipt/timesheets/passover.xls") .

Common errors in this endeavour include:
Using a Sub instead of a Function; TTBOMK Macros cannot run Subs;
Failing to include the parentheses as in DeleteFile
"C:/ipt/timesheets/passover.xls"; one would call the function directly
in VBA without the parentheses but not in a Macro.

Then where are we?
We have had to write a VBA procedure.
The procedure has no error handling, yet.

So one wonders, why not use the VBA without the Macro?

Some comments:
Kill is an archaic and dangerous method. Put some kind of a wild card
in your arguments with Kill and you could lose many files.

Of course, someone may know a better Macro way to do the same thing
that Kill does.

Jan 11 '06 #3
Why do you have to remove it first? Using TransferSpreadsheet, it will just
overwrite the existing spreadsheet. The only time you run into a problem is
if you have the spreadsheet open in Excel when you try to run the procedure.
Here's an example of something I have used:

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"YourTableOrQueryName", "C:\downloads\" & strFileName, True

Linda

"John Baker" <jo********@comcast.net> wrote in message
news:gf********************************@4ax.com...
Hi:

I know that there is a "kill" command, which will remove files from my
system, and that it
can be executed through Access.

Can someone tell me the form of the command to, say, remove a file with
the path:
"C:/ipt/timesheets/passover.xls"
I would be executing it through a macro using ther "run code" function.

Thanks a lot

JOhn Baker

Jan 11 '06 #4
Red
I very may be wrong, but while looking through some code of mine, I do
believe that A97 doesn't overwrite, because I damn sure wouldn't have
written an extra line of code if I didn't have to ;)
~Red

Jan 11 '06 #5
Thank you all for your help. The Dragon has been Slain, and I am now able to move ahead.

Thanks again

John Baker

John Baker <jo********@comcast.net> wrote:
Hi:

I know that there is a "kill" command, which will remove files from my system, and that it
can be executed through Access.

Can someone tell me the form of the command to, say, remove a file with the path:
"C:/ipt/timesheets/passover.xls"
I would be executing it through a macro using ther "run code" function.

Thanks a lot

JOhn Baker


Jan 12 '06 #6

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

Similar topics

13
by: Dixie | last post by:
How do I, in VBA from an access form module, add 5 rows to the top of a spreadsheet called MySpreadsheet.xls. The worksheet is called MyWorksheet and there is already data in the first 5 rows. I...
24
by: cassetti | last post by:
Here's the issue: I have roughly 20 MS excel spreadsheets, each row contains a record. These records were hand entered by people in call centers. The problem is, there can and are duplicate...
1
by: gm | last post by:
Hi; I have written a database that tracks all the installation we have ever done. I have a small heating company. I have recently started keeping a directory of digital photographs of the...
25
by: DFS | last post by:
I have a job to automatically import Excel data and post to database tables, via a point-click interface. Choose-file-and-it-does-the-rest kind of thing. Cient stores data in columns in his...
1
by: garry.oxnard | last post by:
Can anyone help me to solve a problem which involves switching from Access to Excel (then back to Access) programatically please? I have an Excel template which, on open, also opens an Access...
1
by: Mitch | last post by:
I am using Access to create an Excel spreadsheets with graphs related to rows on the sheet1 to the graph on sheet2. I am using the same data but different subsets of the data to make different...
0
by: mix01 | last post by:
Hi, I am trying to get some VBA code working, but am preplex as to why it does not work. I would really appreciate any level of help. Many thanks, Mix01 Version of the program
4
by: oliver james | last post by:
I'm trying to automate an Excel spreadsheet from Access. I've established a link and loaded data from a recordset onto a worksheet in Excel. I now want to perform some manipulation on the data. I...
0
by: Tony Hine | last post by:
Problem for Excel Developers One of the problems facing Excel developers moving into MS Access is actually the apparent similarity between MS Access tables and Excel spreadsheets. MS Access is...
0
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...
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.