Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

List the Search Results

Status
Not open for further replies.

MskMsiva

Aerospace
Jan 6, 2015
15
US
Hi,

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

Thanks in Advance.
 
Replies continue below

Recommended for you

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

- Romania
- EU
 
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.
 
@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:
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top