Hi,
I'm afraid this will no doubt horrendously basic as I'm a complete newbie to VB and have dived in without learning to do much... Start in the deep end and all.
So if anyone could help, I'd appreciate it;
I've got this bit of code and I couldn't for the life of me tell you why it doesn't work, if anyone else can I'd appreciate it!
Cheers
----------------
Sub Folders()
Directory1
Directory2
End Sub
Sub Directory1()
Application.Scr eenUpdating = False
Worksheets("Sum mary").Activate
Dim cli As String
Dim Job As String
cli = Cells(6, 5).Value
Job = Cells(1, 29).Value
Dim FSO, Folder
Set FSO = Server.CreateOb ject("Scripting .FileSystemObje ct")
Folder = "\\Work\tri al reports\" & cli & " \ "
If FSO.FolderExist s(Folder) Then
MsgBox "Client folder exists, creating job folder for certificate"
Else
MkDir "\\Work\Tri al reports\" & cli & "\"
End If
End Sub
Sub Directory2()
Application.Scr eenUpdating = False
Worksheets("Sum mary").Activate
Dim cli As String
Dim Job As String
cli = Cells(6, 5).Value
Job = Cells(1, 29).Value
Dim FSO, File
Set FSO = Server.CreateOb ject("Scripting .FileSystemObje ct")
File = "\\Work\Tri al reports\" & cli & "\" & Job & "\"
If FSO.FolderExist s(File) Then
MsgBox "Job folder exists, please save certificate when complete"
Else
MkDir "\\Work\Tri al reports\" & cli & "\" & Job & "\"
End If
End Sub
----------------
Thanks again!
Ben
2 6896
hi this is seshu
i have a piece of code here but in project refrences you need to add file system object with name microsoft scripting runtime object
on button click event
Dim fsys As New FileSystemObjec t
dim str as string
str="path"
if fsys.folderexis ts(str) then
msgbox"folder exists"
else
fsys.createfold er"path of the folder to be created"\new folder name
msgbox "folder created"
end if
end sub
I've got this bit of code and I couldn't for the life of me tell you why it doesn't work, if anyone else can I'd appreciate it!
Welcome to TheScripts!
Could you give us some idea of what result you do get? "Doesn't work" is awfully vague.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: jenny |
last post by:
Hi, I am trying to find a VB way that would create a folder on all
existing drives - the folder name would be the same on each drive. ie
c:\backup, d:\backup, etc. But the folders would only be created if
they don't already exist, and if the drive happens to be one a folder
cannot be created on (ie a cdrom drive) it would just be skipped
without the code generating any errors.
your help on this would be most appreciated. jenny
|
by: Bryan Rasmussen |
last post by:
Hi
I have a little program that is importing from os.path import exists, join,
isdir, normpath, isfile
at one point in my program I check if a file exists using
if exists("c:\projects"):
and that works fine.
If I change it to be
if exists(thepath):
|
by: Rob Meade |
last post by:
Hi all,
I am allowing a user to create a directory within my application.
I have them entering the name for the directory in a form. When the form is
processed I initially check for any special characters that are not allowed
(Windows based server incidently), from here I then need to check to see
whether the folder name has already been used (either by a previous entry
using the application etc, or reserved names as such ie, /images...
|
by: Joe |
last post by:
I've been running into problems when trying to create a Virtual FTP folder
in ASP.Net. I've tried it a few ways but none of them has worked so far. I
have identity impersonation turned on, and the current user is an
administrator on the machine, so I wouldn't think it's a permissions issue,
but I can't think of anything else that it might be. The first way I tried,
which worked fine in ASP but not ASP.Net, is:
Dim Path
Dim ftpSvc
Dim...
|
by: BerkshireGuy |
last post by:
Hello everyone,
I have a bond form that a user uses to enter data.
One of my fields, is PolicyNumber. I added some code on the Before
Update event of txtPolicyNumber that checks to see if that policy
number is in the system when entering a new record. If it is, I want
it to display a message and go back to the policy number field.
I've tried this code on a policy number that is not in the table and it
| |
by: Brian Henry |
last post by:
How with out creating a COM object, do you check in .NET to see if a folder
exists? I found the check for a file but i need to check for a folder, and
there does not seem to be on in the path class
|
by: RSH |
last post by:
I'm creating databases programatically in .Net and I want to verify that the
database doesn't exist before creating it. i found the SQL code:
IF NOT EXISTS(SELECT * FROM <databasename>)
But when I run the code against a known database, even in SQL Management
Studio I get a "Incorrect syntax near ')' error.
What am i doing wrong?
|
by: patelxxx |
last post by:
Checking the folder before actually creating the new folder .
Can someone guide me in what 'Checks' do I need to do before I create a new folder? I know that one of the checks will be to see if the file already exists or not. What other checks could I do?
See coding for Creating new folder
use CGI;
use strict;
use warnings;
|
by: ndedhia1 |
last post by:
Hi.
I am writing a java program in which I want to ftp a file to another unix box.
First I have to check if the directory exists in which I am ftping into and if it does not exist, I have to create it:
this is the code that I am using that is not working properly:
System.out.println("YOU ARE IN UPLOAD");
System.out.println("THIS IS THE HOST: " + host);
SshClient ssh = new SshClient();
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |