Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 8th, 2004, 12:56 PM
Registered User
Join Date: Jun 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default convert vba code to vb

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.

Reply With Quote
  #2 (permalink)  
Old June 8th, 2004, 01:36 PM
Friend of Wrox
Join Date: Jun 2003
Location: McPherson, Kansas, USA.
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts

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
Reply With Quote
  #3 (permalink)  
Old June 8th, 2004, 01:49 PM
Registered User
Join Date: Jun 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

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
        MsgBox "There were no files found."
    End If
End With

Thanks again!

Reply With Quote
  #4 (permalink)  
Old February 23rd, 2005, 02:13 PM
Authorized User
Join Date: Feb 2005
Location: , , Netherlands.
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts

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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 05:03 AM.

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