×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

List the Search Results

List the Search Results

List the Search Results

(OP)
Hi,

After searching for particular set of items in macro, how to export the search results in a xl or notepad?

Thanks in Advance.

RE: List the Search Results

Hi,

The idea is to create first a text file then fill it by writing what you are reading in CATIA
Dim oFilIn
Set oFilIn = FileSys.CreateFile(FileOut, FALSE)
Dim oStream
Set oStream = oFilIn.OpenAsTextStream("ForWriting")

With something like this you can get the names of your selections.
for i = 1 to selection1.count
Name = selection1.item(i).Value.name
oStream.Write Name & ";" & chr(10)
next

Here you close the operation of writing in text file
oStream.Close

Such operations you can find searching in the forum or on Google....

Regards
Fernando

https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU

RE: List the Search Results

(OP)
Hi Ferdo,

Thanks.

Actually what I need is the path of the item(s) which we search.
In search results, we will have Name & Path of the Item. I am able to export the name but not able to get the entire path.
Kindly suggest a way.

Thanks in Advance.

RE: List the Search Results

@MskMsiva
What kind of items are you trying to get the path for?

To export various text info to excel (or csv) use the code below.

CODE --> vba

Dim strFilePath As String
Dim objFSO As Object
Dim objStream As Object
    
strFilePath = "C:\Users\Drew\Desktop\dimensions.csv"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objStream = objFSO.OpenTextFile(strFilePath, 8, True, 0)
    
For i = 1 To oSel.Count
  objStream.WriteLine (dblDims(0, i - 1) & "," & dblDims(1, i - 1) & "," & dblDims(2, i - 1) & "," & dblDims(3, i - 1))
Next

    objStream.Close 

Regards,
Drew Mumaw
http://www.textsketcher.com/
http://www.drewmumaw.com/

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources