ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy Paste a file into a folder with the current dat (https://www.excelbanter.com/excel-programming/419165-copy-paste-file-into-folder-current-dat.html)

[email protected]

Copy Paste a file into a folder with the current dat
 
Hi Guys,

I have a problem with this Sub:

---
Sub CopyFiles()

'Create the folder with the current date
MkDir "s:\Aat\APA acc\GEOFFROY\CPI Mensuels\ALL APA Positions
\Database_" & Format(Date, "yyyymmdd")


'Copy the files created with Olympic
Set newDir = "s:\Aat\APA acc\GEOFFROY\CPI Mensuels\ALL APA Positions
\Database_" & Format(Date, "yyyymmdd")
Dim SourceFile, DestinationFile
SourceFile = "Q:\Products\Aat\APA Database\Bonds Database
\fapa_bonds.xls" ' Define source file name.
DestinationFile = newDir
FileCopy SourceFile, DestinationFile ' Copy source to target.


End Sub
---
I managed 'to create the folder with the current date', however, I
cannot move the file to this folder. The error occurs at the line
Set newDir = "......"

Thanks a lot to help me guys, and please don't laugh if it is a simple
"" or (), because I am a beginner...
:-)

Mike



Dave Peterson

Copy Paste a file into a folder with the current dat
 
Check your earlier post.

wrote:

Hi Guys,

I have a problem with this Sub:

---
Sub CopyFiles()

'Create the folder with the current date
MkDir "s:\Aat\APA acc\GEOFFROY\CPI Mensuels\ALL APA Positions
\Database_" & Format(Date, "yyyymmdd")

'Copy the files created with Olympic
Set newDir = "s:\Aat\APA acc\GEOFFROY\CPI Mensuels\ALL APA Positions
\Database_" & Format(Date, "yyyymmdd")
Dim SourceFile, DestinationFile
SourceFile = "Q:\Products\Aat\APA Database\Bonds Database
\fapa_bonds.xls" ' Define source file name.
DestinationFile = newDir
FileCopy SourceFile, DestinationFile ' Copy source to target.

End Sub
---
I managed 'to create the folder with the current date', however, I
cannot move the file to this folder. The error occurs at the line
Set newDir = "......"

Thanks a lot to help me guys, and please don't laugh if it is a simple
"" or (), because I am a beginner...
:-)

Mike


--

Dave Peterson


All times are GMT +1. The time now is 11:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com