Wrox Programmer Forums
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 8th, 2004, 12:56 PM
Registered User
 
Join Date: Jun 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default convert vba code to vb

Hello!
This is my first post (of many, I think).

I need to create code in VB and I am really only familiar with VBA (Excel).
I was wondering if the following code (which is taken from the sample examples in Excel's Help files) would work in a regular VB application (and if not, what the equivalent code might be for accomplishing the same task using VB).

Thanks in advance for any help.

T
 
Old June 8th, 2004, 01:36 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, do you have the code you want us to look at? The code should work for the most part. But you may need to reference specific libraries depending on what you are trying to do.



Larry Asher
 
Old June 8th, 2004, 01:49 PM
Registered User
 
Join Date: Jun 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oh, right. The code DUH!!!
Sorry about that
My first post AND my first screw-up (well at least I got that out of the way) :D

Here is the code :

Set fs = Application.FileSearch
With fs
    .LookIn = "C:\My Documents"
    .FileName = "*.doc"
    If .Execute(SortBy:=msoSortbyFileName, _
            SortOrder:=msoSortOrderAscending) > 0 Then
        MsgBox "There were " & .FoundFiles.Count & _
            " file(s) found."
        For i = 1 To .FoundFiles.Count
            MsgBox .FoundFiles(i)
        Next i
    Else
        MsgBox "There were no files found."
    End If
End With


Thanks again!

 
Old February 23rd, 2005, 02:13 PM
Authorized User
 
Join Date: Feb 2005
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i think this is a VBA specific code..i cant remember having seen the FileSearch method in VB





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help me i must convert Code vb to C# pla_2 C# 3 October 14th, 2006 12:54 AM
Why does Excel VBA code run faster than VB? mambojedi Pro VB 6 3 April 24th, 2006 02:48 PM
VBA code convert to SQL omnicap1 Access VBA 2 August 23rd, 2004 03:03 AM
adding VBA code to VB jamie123 VB How-To 1 April 27th, 2004 02:27 AM
Convert VB to C# code skdp VS.NET 2002/2003 2 March 1st, 2004 11:45 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.