用于覆盖文件的宏 [英] Macro to overwrite files

查看:94
本文介绍了用于覆盖文件的宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些帮助。 我想要一个宏的编码,其中一个驱动器被检查一个文件,如果该文件存在,该文件被删除,另一个文件被重命名。

I need some help.  I would like some coding for a macro where the a drive is checked for a file, if the file exists the file is deleted and another file is renamed.

宏 将 是由许多人使用,所以我将使用以下命令重命名新文件,但是我遇到的问题是现有文件已经保存,它不会覆盖它。 有人可以帮忙吗

The macro will be used by a number of people so I was going to use the following to rename the new file, however the problem that I have is that where a existing file is already saved it does not overwrite it.  Can someone please help

子重命名文件()

名称" C:\Documents and Settings \" &安培; Environ("UserName")& " \HelpMe.xls"作为"C:\Documents and Settings \" &安培; Environ("UserName")& " \ HelpMe - Please.xls"

Name "C:\Documents and Settings\" & Environ("UserName") & "\HelpMe.xls" As "C:\Documents and Settings\" & Environ("UserName") & "\HelpMe - Please.xls"

End Sub

推荐答案

随着谈话我正在假设您正在尝试在其中一个办公应用程序中编写Visual Basic宏。

With the talk of macro's I'm assuming you are attempting to write a Visual Basic macro in probably one of the office applications.

如果是这种情况那么 - 请注意,此论坛适用于VB。 NET问题(例如Visual Basic 2003,Visual Basic 2005,Visual Basic 2008)




适用于VBA(Visual Basic for Applications),宏或Excel问题您将获得更好的VBA论坛支持:Visual Basic for Applications(VBA)



http://forums.microsoft.com/msdn/ShowForum.aspx?ForumID=74&SiteID=1


$
(这是Microsoft MSDN网站)

If this is the case then - Please note that this forum is for VB.NET questions only (e.g. Visual Basic 2003, Visual Basic 2005, Visual Basic 2008)

For VBA (Visual Basic for Applications), Macros or Excel Questions you will get better support in the VBA Forums: Visual Basic for Applications (VBA)

http://forums.microsoft.com/msdn/ShowForum.aspx?ForumID=74&SiteID=1

(This is a Microsoft MSDN site)


这篇关于用于覆盖文件的宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆