UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Rename A Folder, Access 2016    
 
   
habiler
post Oct 23 2019, 02:50 PM
Post#1



Posts: 79
Joined: 6-August 15





I have a directory C: pers & ! Nomname & " A. Official Parts ".

I would like that if the files containing A. but not entitled A. Official Parts" are replaced by A. Official Parts "
I wrote a code of which a part is listed below. but it creates me a second empty file.

QUOTE
strPathNl = toPath & "\" & !NomName & "\A. Pieces officielles\"

If fso.FileExists(strPathNl) = False Then
MkDir strPathNl
Else
If Mid(strPathNl, longstrPath, 2) = "A." And fso.FileExists(strPathNl) = False Then
MkDir strPathNl
fso.CopyFolder strPathNl, strPathNl
End If
End If
Go to the top of the page
 
moke123
post Oct 23 2019, 03:00 PM
Post#2



Posts: 1,369
Joined: 26-December 12
From: Berkshire Mtns.


try the Name()
Go to the top of the page
 
dmhzx
post Oct 23 2019, 03:50 PM
Post#3



Posts: 7,115
Joined: 22-December 10
From: England


Looks like if you need to create a new folder, nothing else gets done.
If the destination folder already exists, nothing gets done.

Does copyfolder also copy all files and subfolders?
Go to the top of the page
 
andywal6
post Nov 6 2019, 09:55 AM
Post#4



Posts: 169
Joined: 11-January 08



Have you tried:

Dim OldFolderName As String
Dim NewFolderName As String

If Dir(your folder name, vbDirectory) = "" Then
MkDir (your folder name)
Else
OldFolderName = 'your existingname'
NewFolderName = 'your newname'

Name OldFolderName As NewFolderName

End If

Andy.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    7th December 2019 - 01:12 AM