Problem to read open documents
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
i have the following code that looks for open inventor files, discard what it is not an assembly and prepare a list of selectable document, then data are retrieved from the model and written on an excel sheet.
The purpose of this function is to give the user the ability to say from which assembly he/she can retrieve data.
All is performed within an excel workbook.
The problem I'm facing is:
when I open a new file and run the code, it will not shows the new opened document in the selectable list. It seemes that there's a kind of "cache", but I don't know exactly how it works.
e.g
I open assembly1, run the code, a pop-up windows show in the list the "assembly1.iam" row
If then I open another assembly (assembly2) and rerun the code, only assembly1 is selectable.
How would you manage that?
Thanks
Michele
I defined as global variable on the module the inventor application
Option Explicit
Dim invApp As Inventor.Application
here's the GetDocumentList function...
Private Function GetDocumentList(ByRef docs As Object) As Variant
Dim assiemiCount As Integer
Dim i As Integer
Dim doc As Object
Dim docNames, selectedDocName As String
Dim isAssemblyDocument, selezioneValida, gestioneCiclo As Boolean
For i = 1 To docs.VisibleDocuments.Count
Set doc = docs.Item(i)
isAssemblyDocument = TypeName(doc) = "AssemblyDocument"
If InStr(doc.FullFileName, "iam") And isAssemblyDocument Then
docNames = docNames & i & ": " & doc.DisplayName & vbCrLf
assiemiCount = assiemiCount + 1
End If
Next i
If assiemiCount ....