Hi All,
When i run below code It's not creating folder.... In can see it in msgbox prompt it showing correctly .. Could you pls help me where iam wrong.... -
-
Dim str As String
-
ftp_Date = Format(Date, "yyyymmdd")
-
str = "D:\Daily FXPCA Trade Report\" & ftp_Date
-
MsgBox str
-
MkDir str
-
6 7828
I've used this successfully: - Dim fso As Object
-
Dim str As String
-
str = ...
-
Set fso = CreateObject("Scripting.FileSystemObject")
-
If Not fso.FolderExists(str) Then
-
fso.CreateFolder(str)
-
End If
NeoPa 32,556
Expert Mod 16PB
It doesn't seem too wrong to me :S
Can you check that the string is all spelt correctly (no typos) and that the parent folder exists already. Lastly, check the permissions of the parent folder (Can you create such a subfolder manually?).
This appears to be a case where you may wish to incorporate a simple Error Trap into the coding, to more clearly indicate any Errors which may occur, as in: - On Error GoTo Err_FolderCreation
-
Dim str As String
-
Dim ftp_Date As Variant
-
Const conPATH_FILE_ACCESS_ERROR = 75
-
-
ftp_Date = Format(Date, "yyyymmdd")
-
str = "D:\Daily FXPCA Trade Report\" & ftp_Date
-
-
MkDir str
-
-
MsgBox "The following Path, " & str & ", has successfully been created!", _
-
vbInformation, "Path Created"
-
-
Exit_FolderCreation:
-
Exit Sub
-
-
Err_FolderCreation:
-
If Err.Number = conPATH_FILE_ACCESS_ERROR Then 'The Folder already exists/Network Error
-
MsgBox "The following Path, " & str & ", already exists or there was an Error " & _
-
"accessing it!", vbExclamation, "Path/File Access Error"
-
Else
-
MsgBox Err.Description, vbExclamation, "Error Creating " & str
-
End If
-
Resume Exit_FolderCreation
Thanks ADeZii,
It worked
Thanks a lot....
NeoPa 32,556
Expert Mod 16PB
Perhaps you could tell us what you found the problem to be in the end?
@harshakusam
You are quite welcome. I'll repeat what NeoPa has already asked, what exactly was the problem?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Salmo Bytes |
last post by:
I have a script that wants to mirror
a directory structure, reading
from location1 and writing (mkdir) at location2.
This code works fine on a my own desktop test box.
But fails at 'mkdir' when...
|
by: Shaun |
last post by:
Hello!
I can't seem to get paths and variables working together:
import os
a = 'books'
os.chdir( '/test')
os.mkdir("/test/"a)
the last line does not seem to work. os.mkdir(a) makes the...
|
by: DataSmash |
last post by:
Hello,
I think I've tried everything now and can't figure out how to do it.
I want to read in a text list from the current directory,
and for each line in the list, make a system directory for...
|
by: Sue |
last post by:
AccessXP in Access2000 Mode:
In my code I use the MkDir method to create a folder and then I want to use the
transfertext method to create a delimited text file in that folder. MkDir runs
and...
|
by: eoindeb |
last post by:
I am trying to create a directory on Solaris using the mkdir()
function. This works fine when I pass a string literal ("/etc/hosts")
to mkdir, but if I try passing a directory pointer to mkdir, it...
|
by: MikeC |
last post by:
Good People,
I'm writing a backup utility that uses a chdir() to go into the source
directory (in which the files reside that I want to back up), so I don't
want to use chdir() to get into the...
|
by: vj |
last post by:
How do I do the following unix command:
mkdir -m770 test
with the os.mkdir command. Using os.mkdir(mode=0770) ends with the
incorrect permissions.
Thanks,
VJ
|
by: Cris |
last post by:
OK, I do this call on a linux system:
if(!file_exists("../pages/".$_POST."/"))
{
$dirname = "/home/u2/sss/sss/html/pages/".$_POST."";
mkdir($dirname, $mode);
}
and get this:
|
by: John |
last post by:
Hi
The following does not create a directory neither does it give any error
message. Any ideas?
$umask=umask(0);
$where="/var/www/vhosts/example.com/httpdocs/friday/";
mkdir ($where,0777);...
|
by: _q_u_a_m_i_s's |
last post by:
Hy,
i encountered a weird problem on a server running php5, and apache.
Seems like i cannot create folders that end with "/".
for example:
mkdir("test/") will fail
mkdir("test") will work
Is...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
| |