- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm trying to open each ipt file in a folder and run all iLogicRules.
I' m getting the following error: Object variable or With block variable not set.
See code below:
'Get iLogic addins
Dim addIn As ApplicationAddIn
Dim addIns As ApplicationAddIns
Set addIns = ThisApplication.ApplicationAddIns
For Each addIn In addIns
If InStr(addIn.DisplayName, "iLogic") > 0 Then
addIn.Activate
Dim iLogicAuto As Object
Set iLogicAuto = addIn.Automation
End If
Next
'detect full path to current opened file
File_Name = ThisApplication.ActiveEditObject.ComponentDefinition.Document.FullFileName
myobject.Close
'detect current directory
Directory = Left(File_Name, InStrRev(File_Name, "\") - 1)
'look for all files in the current directory, open, rebuilt and update
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(Directory)
Set fc = f.Files
For Each fl In fc
If ((InStr(fl, "kelet") <> 0 Or InStr(fl, "param") <> 0) And InStr(fl, ".ipt") <> 0) Then
Set pDoc = ThisApplication.Documents.Open(fl)
Set pDoc = ThisApplication.ActiveDocument
'RunAllRules (pDoc)
Dim rules As Object
rules = iLogicAuto.rules(pDoc)
Stop
If Not (rules Is Nothing) Then
For Each rule In rules
iLogicAuto.RunRuleDirect (rule)
Next
End If
pDoc.Update
pDoc.Rebuild
On Error GoTo 10
pDoc.Save
pDoc.Close
End If
Next
Any help is much appreciated. Thanks.
Gus
Solved! Go to Solution.