PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

"Dir" statement in VBScript ...

 
 
=?Utf-8?B?VmF1Z2hhbg==?=
Guest
Posts: n/a
 
      28th Jan 2005
.... does it work? I'm getting an error (type mismatch) and don'ty know if
I've used it incorrectly or if it simply doesn't work in VBS.
 
Reply With Quote
 
 
 
 
Sue Mosher [MVP-Outlook]
Guest
Posts: n/a
 
      28th Jan 2005
How would anyone be able to tell without seeing your code?

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Vaughan" <(E-Mail Removed)> wrote in message
news:96074FBF-DBB8-446C-AD27-(E-Mail Removed)...
> ... does it work? I'm getting an error (type mismatch) and don'ty know if
> I've used it incorrectly or if it simply doesn't work in VBS.



 
Reply With Quote
 
Wolfram Jahn
Guest
Posts: n/a
 
      28th Jan 2005
Sue Mosher [MVP-Outlook] wrote:
> How would anyone be able to tell without seeing your code?
>

Easy, Sue.
There is no 'dir' function in VBSCRIPT.

See:
http://msdn.microsoft.com/library/de...ifunctions.asp

:-)

Wolfram
 
Reply With Quote
 
Sue Mosher [MVP-Outlook]
Guest
Posts: n/a
 
      28th Jan 2005
My point is that if the original poster shows their code and thereby what
they're trying to accomplish, it should be possible to steer them in the
right direction.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Wolfram Jahn" <(E-Mail Removed)> wrote in message
news:cte1fs$o8h$02$(E-Mail Removed)...
> Sue Mosher [MVP-Outlook] wrote:
>> How would anyone be able to tell without seeing your code?
>>

> Easy, Sue.
> There is no 'dir' function in VBSCRIPT.
>
> See:
> http://msdn.microsoft.com/library/de...ifunctions.asp
>
> :-)
>
> Wolfram



 
Reply With Quote
 
=?Utf-8?B?VmF1Z2hhbg==?=
Guest
Posts: n/a
 
      29th Jan 2005
Sue, I can definitely see where you're coming from with this. That's why I
originally wrote my question like this:

> I have a custom form with a combo-box control. The Combo-box is populated
> with data from an Access database using DAO. It works fine, but there's one
> minor issue with remote users. If they aren't connected to the company
> network, they obviously can't populate the combo-box and the form errors out,
> which is fine, but r_e_a_l_l_y s_l_o_w_l_y, which is not fine.
>
> The problem is that the error is generated by this line of code:
>
> Set DatBase = DBEngine.OpenDatabase(strDBPath & strDBName)
>
> I'm sure if I knew how to test whether strDBPath was a valid path before
> calling the OpenDatabase object, it would be seconds quicker, but I don't
> know how to do it. This must be easy, but I don't really know where to start
> with it.
>
> Can anyone advise?
>
> Thanks in advance
>
> Vaughan
>
>


But that didn't excite anyone enough to get a response. Having posted about
20 or so questions to this group over six months, I have found that when I
give a full explanation of what I'm trying to do nobody answers. If I then
boil the question down to a couple of lines, I usually get exactly what I
need (more often than not from you Sue. And believe me, I couldn't be more
grateful for all your help.)

In this case, the ploy only worked up to a point. Wolfram has answered my
specific question (thanks Wolfie) but, as you spotted, that doesn't resolve
my overall problem of how to test whether the path to my database is valid
when I run the form. If you (or anyone) can give me a solution to that, I
would be most extremely grateful.

Thanks again for your interest and help

Vaughan

"Sue Mosher [MVP-Outlook]" wrote:

> My point is that if the original poster shows their code and thereby what
> they're trying to accomplish, it should be possible to steer them in the
> right direction.
>
> --
> Sue Mosher, Outlook MVP
> Author of
> Microsoft Outlook Programming - Jumpstart for
> Administrators, Power Users, and Developers
> http://www.outlookcode.com/jumpstart.aspx
>
>
> "Wolfram Jahn" <(E-Mail Removed)> wrote in message
> news:cte1fs$o8h$02$(E-Mail Removed)...
> > Sue Mosher [MVP-Outlook] wrote:
> >> How would anyone be able to tell without seeing your code?
> >>

> > Easy, Sue.
> > There is no 'dir' function in VBSCRIPT.
> >
> > See:
> > http://msdn.microsoft.com/library/de...ifunctions.asp
> >
> > :-)
> >
> > Wolfram

>
>
>

 
Reply With Quote
 
Wolfram Jahn
Guest
Posts: n/a
 
      29th Jan 2005
Hi,

you could have added one short question to your OP, e.g.

> ... does it work? I'm getting an error (type mismatch)
> and don'ty know if I've used it incorrectly or if it
> simply doesn't work in VBS.

+++
> Any other chance to get file/dir information?

---

Short and clear.

If you ask if dir does/doesn't work then the answer that dir doesn't
exist is exact. I do not want to guess your questions.

Now that you asked, did you consider to use scripting?

http://msdn.microsoft.com/library/de...stemobject.asp

found there:

Function ReportFileStatus(filespec)
Dim fso, msg
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(filespec)) Then
msg = filespec & " exists."
Else
msg = filespec & " doesn't exist."
End If
ReportFileStatus = msg
End Function


Kind regards

Wolfram
 
Reply With Quote
 
=?Utf-8?B?VmF1Z2hhbg==?=
Guest
Posts: n/a
 
      30th Jan 2005
Hi Wolfram

You are absolutely right, I will make sure my osts are more carefully worded
in the future.

And thanks for our suggestions which seems to do exactly what I wanted. I
just have one question. To make it work on my machine I had to add the
Scriting runtime Library to the list of references in Outlook. Will I need to
do this for everyone who uses the form, or can I get the library to be added
by coding it in the form somehow?

Thanks

Vaughan

"Wolfram Jahn" wrote:

> Hi,
>
> you could have added one short question to your OP, e.g.
>
> > ... does it work? I'm getting an error (type mismatch)
> > and don'ty know if I've used it incorrectly or if it
> > simply doesn't work in VBS.

> +++
> > Any other chance to get file/dir information?

> ---
>
> Short and clear.
>
> If you ask if dir does/doesn't work then the answer that dir doesn't
> exist is exact. I do not want to guess your questions.
>
> Now that you asked, did you consider to use scripting?
>
> http://msdn.microsoft.com/library/de...stemobject.asp
>
> found there:
>
> Function ReportFileStatus(filespec)
> Dim fso, msg
> Set fso = CreateObject("Scripting.FileSystemObject")
> If (fso.FileExists(filespec)) Then
> msg = filespec & " exists."
> Else
> msg = filespec & " doesn't exist."
> End If
> ReportFileStatus = msg
> End Function
>
>
> Kind regards
>
> Wolfram
>

 
Reply With Quote
 
Wolfram Jahn
Guest
Posts: n/a
 
      30th Jan 2005
Vaughan wrote:

> To make it work on my machine I had to add the
> Scriting runtime Library to the list of references in Outlook.


If you use vbscript code in a custom form you need no reference in Outlook.

> Will I need to
> do this for everyone who uses the form, or can I get the library to be added
> by coding it in the form somehow?


I just checked it - I had not even to open the vba editor, just
customized a form, and the code ran.

If you like, I will send an example .oft file by email.

Wolfram
 
Reply With Quote
 
=?Utf-8?B?VmF1Z2hhbg==?=
Guest
Posts: n/a
 
      31st Jan 2005
Thanks Wolfman

I tested the form on some other pcs around here and they all worked fine.
The code I already have works fine too, so you don't need to email the .oft
file.


I think this one is resolved now.

Best regards

Vaughan



"Wolfram Jahn" wrote:

> Vaughan wrote:
>
> > To make it work on my machine I had to add the
> > Scriting runtime Library to the list of references in Outlook.

>
> If you use vbscript code in a custom form you need no reference in Outlook.
>
> > Will I need to
> > do this for everyone who uses the form, or can I get the library to be added
> > by coding it in the form somehow?

>
> I just checked it - I had not even to open the vba editor, just
> customized a form, and the code ran.
>
> If you like, I will send an example .oft file by email.
>
> Wolfram
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
IIF statement in query criteria to have "Like "*" or Is Null" as the result if true bdt513@yahoo.com Microsoft Access Queries 5 19th Jul 2006 07:38 PM
Is there a "white paper" template for "statement of facts"? =?Utf-8?B?U2FsZXMgVGF4IEd1eQ==?= Microsoft Word Document Management 0 7th Oct 2005 10:01 PM
Syntax error in UPDATE statement - field name "Upper", or "Lower" =?Utf-8?B?SWdvciBHZWd1c2lu?= Microsoft ADO .NET 2 19th Oct 2004 04:17 PM
Equivalient of VBScript's "Eval" and "Execute" statements Mike Microsoft ASP .NET 2 4th Oct 2004 11:00 PM
"IF" statement displays "False" instead of "0" =?Utf-8?B?QWw=?= Microsoft Excel Worksheet Functions 1 23rd Jul 2004 03:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:14 PM.