Hi,
I try to do the following
open an automatically created file =>create new name based on cell values => save as new name in folder 2 => kill the original file=> continue macros on newly named file.
I usually grab most of my VBA from the web and adjust to my needs, but I didn't find any good examples.
At the moment it does the saving bit, but the killing won't work. I can't put the filename in the kill path
this is part of the code, I omitted the automatically opening which works fine
sub killfile()
Dim stFile2 As String
Dim stNewPath As String
Dim stoldpath As String
Dim stfile1 As String
stfile1 = ActiveWorkbook.Name
Range("B1").Select
ActiveCell.FormulaR1C1 = "=CONCATENATE(R[17]C,R[18]C)"
stPath = "c:\"
stNewPath = "C:\folder2"
stoldpath = "C:\folder1"
stFile2 = Range("b1").Text
If Dir(stNewPath, vbDirectory) = "" Then MkDir stNewPath
ActiveWorkbook.SaveAs stNewPath & "\" & stFile2 & " " & Format(Now(), "dd-mm-yyyy"), FileFormat:=xlNormal
Kill "c:\folder1" & "\" & stfile1"
end sub
Bookmarks