Advertisement

03.13.2007 at 03:33AM PDT, ID: 22445549
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.8

Convert VBScript to VBA - put code into a form and pass a variable from the form

Asked by William_Conway in Access Coding/Macros, Microsoft Access Database, VB Script

Tags: , ,

Convert VBScript to VBA - so code can be used in an access project.
Yesterday I had a problem whereby I need some vbscript code - to search text files in a given folder and sub foler for a text search string and if it exists in the txt files copy them to a certain directory. SirBounty - came up with a beautiful piece of code for me that did exactly what I need - the code is below. When clicked you are asked to enter the string to search for and then bobs your uncle it does exactly what it says on the tin. Now this morning the criteria has changed I need to convert the VBScript to VBA and put it into an access database - the script will run the exact same except rather than entering the text - you willl select from a combo box and click a button to complete.
What I have tried so far is fairly basic _ I have created the form added the combo box - entered the items i want to appear in it - created the button - and for the moment hard coded the search string in - (I was hoping to get it working this way first then add in the pass from combo functionality. But I am fastly running around in cirlces and seeing as coding is my weak area I think its time for help

Code

Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")


strFolder= "C:\Source\"
strDestination= "C:\Destination\"
strToFind = InputBox("What string are you looking for?", "Search String")


ProcessFolder objFSO.GetFolder(strFolder)

Set objFSO=Nothing
wscript.quit

Sub ProcessFolder(strSource)
  ProcessFiles strSource
  For Each fld In strSource.SubFolders
    ProcessFolder fld
  Next
End Sub

Sub ProcessFiles(strSrc)
  On error resume next
  If err.Number=0 Then
    For Each file In strSrc.Files
      arrData=Split(objFSO.OpenTextFile(file.Path).ReadAll,vbNewLine)
      For Each item in arrData
          If InStr(lcase(item), lcase(strToFind))  > 0 Then objFSO.CopyFile file.path, strDestination
        counter + 1
      Next
    Next
  End If
End Sub Start Free Trial
[+][-]03.13.2007 at 03:39AM PDT, ID: 18708904

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 04:24AM PDT, ID: 18709113

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 05:35AM PDT, ID: 18709484

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 05:47AM PDT, ID: 18709577

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 05:56AM PDT, ID: 18709635

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 06:13AM PDT, ID: 18709764

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 08:27AM PDT, ID: 18711085

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Coding/Macros, Microsoft Access Database, VB Script
Tags: vba, convert, vbscript
Sign Up Now!
Solution Provided By: HKComputer
Participating Experts: 2
Solution Grade: A
 
 
[+][-]03.13.2007 at 09:35AM PDT, ID: 18711756

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 09:45AM PDT, ID: 18711855

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 09:53AM PDT, ID: 18711925

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 09:56AM PDT, ID: 18711949

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32