Close a different open drawing within iLogic - batch export drawing pdf etc

Close a different open drawing within iLogic - batch export drawing pdf etc

andrew_canfield
Collaborator Collaborator
1.005 Vistas
14 Respuestas
Mensaje 1 de 15

Close a different open drawing within iLogic - batch export drawing pdf etc

andrew_canfield
Collaborator
Collaborator

Hello

I have a super bit of clunky code which I'm trying to repurpose.

The original requires a spread sheet setting up with the assembly browser names entering alongside detailed & simplified paths to files - all is suppressed in the Assembly. The code iterates down the list - swaps out simple for detail, exports a dwf, swaps back to detail, suppresses & moves to the next browser name (to create a set of dwf's to load into Navisworks from a pretty large .iam file) - crude but functional.

The same method is being used to open a set of drawings, opening will work, can't close them though!

I've other bits of code to print open drawings but nothing to close them - my guess was to use the excel file to give me the path to open the file, then export versions to a desktop folder, then close the file. The last part is difficult to find- can you close a different open file from iLogic? 

'NNx number count to iterate down excel row
'FFx Full File path held in column D
'LIST.xlsx column D contains the file path

For NNx = 2 To 3 ' for testing only the top 3 rows are used
	
	'PIX = "A"& NNx
	'BNX = "B"& NNx
	'LBX = "C"& NNx
	FFX = "D" & NNx	
	
'MessageBox.Show(PIX, "PIX")
' PIZ reads the PI number from column A
' BNZ reads the Browser Name from Column B
' LBZ reads the path of the substitute path
' FFZ reads the path to the Full Fat detailed part

'PIZ = GoExcel.CellValue("LIST.xlsx", "Sheet1", PIX)
'BNZ = GoExcel.CellValue("LIST.xlsx", "Sheet1", BNX)
'LBZ = GoExcel.CellValue("LIST.xlsx", "Sheet1", LBX)
FFZ = GoExcel.CellValue("LIST.xlsx", "Sheet1", FFX)


'MessageBox.Show(PIZ, "PI")
'MessageBox.Show(BNZ, "BN")
'MessageBox.Show(LBZ, "LB")
'MessageBox.Show(FFZ, "FF")


Dim aList As New List(Of String)

aList.Add(FFZ)

For Each Str As String In aList
    System.Console.WriteLine(Str)
	ThisDoc.Launch(Str)
	
	'code inserted here to save as pdf, dwg, dxf & export parts list in deskstop folder
	
	'ThisDoc.Close(Str) - made up line & obviously doesn't work!

Next
	
Next

 Regards

 

Andrew

0 Me gusta
Soluciones aceptadas (2)
1.006 Vistas
14 Respuestas
Respuestas (14)
Mensaje 2 de 15

A.Acheson
Mentor
Mentor
Solución aceptada

This works for me. ThisDoc is an ilogic snippet and can only be used where the rule is originally run from. So if you were to use it to get the path and filename like this

ThisDoc.PathAndFileName
MessageBox.Show(ThisDoc.PathAndFileName, "Title")

 

this would return the filename you are running the rule from. 

 

'NNx number count to iterate down excel row
'FFx Full File path held in column D
'LIST.xlsx column D contains the file path

For NNx = 2 To 3 ' for testing only the top 3 rows are used
	
	'PIX = "A"& NNx
	'BNX = "B"& NNx
	'LBX = "C"& NNx
	FFX = "D" & NNx	
	
'MessageBox.Show(PIX, "PIX")
' PIZ reads the PI number from column A
' BNZ reads the Browser Name from Column B
' LBZ reads the path of the substitute path
' FFZ reads the path to the Full Fat detailed part

'PIZ = GoExcel.CellValue("LIST.xlsx", "Sheet1", PIX)
'BNZ = GoExcel.CellValue("LIST.xlsx", "Sheet1", BNX)
'LBZ = GoExcel.CellValue("LIST.xlsx", "Sheet1", LBX)
FFZ = GoExcel.CellValue("C:\Users\aacheson\Desktop\WFH\Forum\LIST.xlsx", "Sheet1", FFX)


'MessageBox.Show(PIZ, "PI")
'MessageBox.Show(BNZ, "BN")
'MessageBox.Show(LBZ, "LB")
'MessageBox.Show(FFZ, "FF")


Dim aList As New List(Of String)

aList.Add(FFZ)

	For Each Str As String In aList
	   ' System.Console.WriteLine(Str)
		
		ThisDoc.Launch(Str)

		Dim doc As Document = ThisApplication.ActiveDocument
			
		'code inserted here to save as pdf, dwg, dxf & export parts list in deskstop folder
			
		'MessageBox.Show(doc.FullFileName, "Title")
		doc.Close

	Next
	
Next

 

 

Or you could  do this as well from this post  

'make the spoon "real"
'True opens visible, false opens invisible
oDoc = ThisApplication.Documents.Open(Str,True) 

'see the spoon
	MessageBox.Show("Bend spoon as needed.", "iLogic")

'make the spoon vanish
oDoc.Close

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Me gusta
Mensaje 3 de 15

andrew_canfield
Collaborator
Collaborator

Many Thanks -  not 100% sure I understand why this works & some odd behavior can be seen where the first file will close but not the second (or third). More browsing found this:

https://forums.autodesk.com/t5/inventor-forum/creating-file-with-ilogic-dwg-idw/td-p/8684108

 

&  swapping 

doc.Close  

 to

Call doc.Close(True)

fixes the issue, just got lucky.

0 Me gusta
Mensaje 4 de 15

A.Acheson
Mentor
Mentor

Did you use the long method to get the document?

Dim doc As Document = ThisApplication.ActiveDocument
doc.Close

Here is the explanation of the close with boolean option(true/false), perhaps there was some changes that would have required a save to be carried out before the close. But with this call you have opted to skip the save. 

 

AAcheson_1-1629074818449.png

 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Me gusta
Mensaje 5 de 15

andrew_canfield
Collaborator
Collaborator

The next step is tricky - copied code & tested in a drawing & works - add the same code into the area set aside to export (parts list) & it fails - guessing it's something to do with identifying the active document?

 

'NNx number count to iterate down excel row
'FFx Full File path held in column D
'LIST.xlsx column D contains the file path

For NNx = 2 To 4 ' for testing only the top 3 rows are used
	
	PIX = "A"& NNx
	'BNX = "B"& NNx
	'LBX = "C"& NNx
	FFX = "D" & NNx	
	
'MessageBox.Show(PIX, "PIX")
' PIZ reads the PI number from column A
' BNZ reads the Browser Name from Column B
' LBZ reads the path of the substitute path
' FFZ reads the path to the Full Fat detailed part

PIZ = GoExcel.CellValue("LIST.xlsx", "Sheet1", PIX)
'BNZ = GoExcel.CellValue("LIST.xlsx", "Sheet1", BNX)
'LBZ = GoExcel.CellValue("LIST.xlsx", "Sheet1", LBX)

FFZ = GoExcel.CellValue("LIST.xlsx", "Sheet1", FFX)
'FFZ = GoExcel.CellValue("C:\Users\aacheson\Desktop\WFH\Forum\LIST.xlsx", "Sheet1", FFX)


'MessageBox.Show(PIZ, "PI")
'MessageBox.Show(BNZ, "BN")
'MessageBox.Show(LBZ, "LB")
'MessageBox.Show(FFZ, "FF")


Dim aList As New List(Of String)

aList.Add(FFZ)

	For Each Str As String In aList
	   ' System.Console.WriteLine(Str)
		
		ThisDoc.Launch(Str)

		Dim doc As Document = ThisApplication.ActiveDocument
			
		'code inserted here to save as pdf, dwg, dxf & export parts list in deskstop folder
			MessageBox.Show(doc.FullFileName, FFZ)
		
		'
		'xxxxxxxxxxxxxxxxxx
		
		' REF http://inventortrenches.blogspot.com/2011/02/ilogic-code-for-parts-lists-title.html
		
'Export Parts List
'path_and_name = ThisDoc.PathAndFileName(False) ' without extension
path_and_name = FFZ
''Dim oDoc As Inventor.DrawingDocument
'oDoc = ThisApplication.ActiveDocument

Dim oSheet As Inventor.Sheet
'oSheet = oDoc.Sheets(1) ' first sheet
oSheet = doc.Sheets("A0:1") ' sheet by name - edited match the drawing - was "SHEET:1"

' say there is a Partslist on the sheet.
Dim oPartslist As PartsList
oPartslist = oSheet.PartsLists(1)

On Error GoTo handleXLSLock
'Publish document.
' export the Partslist to Excel.


oPartslist.Export(path_and_name & ".xls", PartsListFileFormatEnum.kMicrosoftExcel) 


Exit Sub
handleXLSLock:
MessageBox.Show("No XLS", "iLogic")
Resume Next	
		'xxxxxxxxxxxxxxxxxxxxxxx
		'		
		'doc.Close
		Call doc.Close(True)

	Next
	
Next
0 Me gusta
Mensaje 6 de 15

A.Acheson
Mentor
Mentor

Can you make a screencast or video of the error happening or find out where it is happening with a message box? 

 

The only place I found an error on was closing, but only sometimes , it wouldn't error out but would do nothing. 

So I have placed an error catching there. 

	Try
	Call doc.Close(True)
	Catch
	End Try

Also the filepath for the excel file will need the extension removed before saving otherwise it looks messy and could give you bad results. 

path_and_name = Left(FFZ,(Len(FFZ)-4))

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Me gusta
Mensaje 7 de 15

andrew_canfield
Collaborator
Collaborator

Many Thanks for looking at this. I took a step back to look at the batch pdf export rule available & cut & paste the into the excel selection part & success (but not too slick)! Now returning to exporting the parts list is still problematic. The sheets have been renamed from SHEET to A0 (or A1, A2, A3) - the working pdf export code is this: 

Sub Main



'NNx number count To iterate down excel Row
'FFx Full File path held in column D
'LIST-CU.xlsx column D contains the file path

For NNx = 2 To 4 ' for testing only the top 3 rows are used
	
	'PIX = "A"& NNx
	'BNX = "B"& NNx
	'LBX = "C"& NNx
	FFX = "D" & NNx	
	
'MessageBox.Show(PIX, "PIX")
' PIZ reads the PI number from column A
' BNZ reads the Browser Name from Column B
' LBZ reads the path of the substitute path
' FFZ reads the path to the Full Fat detailed part

'PIZ = GoExcel.CellValue("LIST-CU.xlsx", "Sheet1", PIX)
'BNZ = GoExcel.CellValue("LIST-CU.xlsx", "Sheet1", BNX)
'LBZ = GoExcel.CellValue("LIST-CU.xlsx", "Sheet1", LBX)

FFZ = GoExcel.CellValue("LIST-CU.xlsx", "Sheet1", FFX)
'FFZ = GoExcel.CellValue("C:\Users\aacheson\Desktop\WFH\Forum\LIST-CU.xlsx", "Sheet1", FFX)


'MessageBox.Show(PIZ, "PI")
'MessageBox.Show(BNZ, "BN")
'MessageBox.Show(LBZ, "LB")
'MessageBox.Show(FFZ, "FF")


Dim aLIST As New List(Of String)

aLIST.Add(FFZ)

	For Each Str As String In aLIST
	   ' System.Console.WriteLine(Str)
		
		ThisDoc.Launch(Str)

		Dim doc As Document = ThisApplication.ActiveDocument
			
		'code inserted here to save as pdf, dwg, dxf & export parts LIST-CU in deskstop folder
				
		'
		'xxxxxxxxxxxxxxxxxx
		
	For Each oDoc In ThisApplication.Documents
		If oDoc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
			Call PrintPDF(oDoc)
		End If
	Next

	
		'xxxxxxxxxxxxxxxxxxxxxxx
		
			
		'MessageBox.Show(doc.FullFileName, FFZ)
		'doc.Close
		Call doc.Close(True)

	Next
	
Next
End Sub


Sub PrintPDF(oDoc As Document)
	
	
Dim oFolder As String = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop) & "\PDF"
If Not System.IO.Directory.Exists(oFolder) Then 
    System.IO.Directory.CreateDirectory(oFolder)
End If

FileName1 = Left(oDoc.DisplayName, Len(oDoc.DisplayName))
'StrLength = FileName1.Length()
'If StrLength = 21 Then  oFileName = Left(oDoc.DisplayName, Len(oDoc.DisplayName) - 4)
'If StrLength = 17 Then oFileName = Left(oDoc.DisplayName, Len(oDoc.DisplayName))

'path_and_name = ThisDoc.PathAndFileName(False) ' without extension

oFileName = Left(FileName1,(Len(FileName1)-4))

MessageBox.Show(oFileName, "path_and_name")



'oFileName = Left(oDoc.DisplayName, Len(oDoc.DisplayName))
'oFileName = Left(oDoc.DisplayName, Len(oDoc.DisplayName) -4)
'oRevNum = oDoc.PropertySets.Item("Inventor Summary Information").Item("Revision Number").Value
oRevNum = oDoc.PropertySets.Item("Inventor User Defined Properties").Item("Issue").Value
oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById _
("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium 


If oPDFAddIn.HasSaveCopyAsOptions(oDoc, oContext, oOptions) Then
oOptions.Value("All_Color_AS_Black") = 1
oOptions.Value("Remove_Line_Weights") = 1
oOptions.Value("Vector_Resolution") = 400
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
'oOptions.Value("Custom_Begin_Sheet") = 2'oOptions.Value("Custom_End_Sheet") = 4
End If 


 'Set the PDF target file name
oDataMedium.FileName = oFolder & "\" & oFileName & "." &  oRevNum & ".pdf" 
'oDataMedium.FileName = oFolder & "\" & oFileName & ".pdf" 

'Publish document
oPDFAddIn.SaveCopyAs(oDoc, oContext, oOptions, oDataMedium) 
End Sub
0 Me gusta
Mensaje 8 de 15

A.Acheson
Mentor
Mentor

I am glad it is starting to pay off for you. The amount of times I have been in the same situation not knowing if more hours will solve it or a clear head on a new day.  If you can identify where the rule might fail you can make it more universal with some error trapping etc.

Is it necessary to define the sheet name where the file partslist resides? If you only have one partslist you can just loop through the sheets and get the partslist on what ever sheet it lives on. No need to input the sheet name then which could help if the name were not consistent. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Me gusta
Mensaje 9 de 15

andrew_canfield
Collaborator
Collaborator

Taking the previously sent working version - replace the sub exporting pdf with one to export a parts list throws up an error:  Object reference not set to an instance of an object.

placing the PL export code within a single drawing works - trying to get it to see a different file is the issue I guess?

 

Sub Main


'NNx number count To iterate down excel Row
'FFx Full File path held in column D
'LIST-CU.xlsx column D contains the file path

For NNx = 2 To 4 ' for testing only the top 3 rows are used
	
	'PIX = "A"& NNx
	'BNX = "B"& NNx
	'LBX = "C"& NNx
	FFX = "D" & NNx	
	
'MessageBox.Show(PIX, "PIX")
' PIZ reads the PI number from column A
' BNZ reads the Browser Name from Column B
' LBZ reads the path of the substitute path
' FFZ reads the path to the Full Fat detailed part

'PIZ = GoExcel.CellValue("LIST-CU.xlsx", "Sheet1", PIX)
'BNZ = GoExcel.CellValue("LIST-CU.xlsx", "Sheet1", BNX)
'LBZ = GoExcel.CellValue("LIST-CU.xlsx", "Sheet1", LBX)

FFZ = GoExcel.CellValue("LIST-CU.xlsx", "Sheet1", FFX)
'FFZ = GoExcel.CellValue("C:\Users\aacheson\Desktop\WFH\Forum\LIST-CU.xlsx", "Sheet1", FFX)


'MessageBox.Show(PIZ, "PI")
'MessageBox.Show(BNZ, "BN")
'MessageBox.Show(LBZ, "LB")
'MessageBox.Show(FFZ, "FF")


Dim aLIST As New List(Of String)

aLIST.Add(FFZ)

	For Each Str As String In aLIST
	   ' System.Console.WriteLine(Str)
		
		ThisDoc.Launch(Str)

		Dim doc As Document = ThisApplication.ActiveDocument
			
		'code inserted here to save as pdf, dwg, dxf & export parts LIST-CU in deskstop folder
				
		'
		'xxxxxxxxxxxxxxxxxx
		
	For Each oDoc In ThisApplication.Documents
		If oDoc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
			Call PL(oDoc)
		End If
	Next

	
		'xxxxxxxxxxxxxxxxxxxxxxx
		
			
		'MessageBox.Show(doc.FullFileName, FFZ)
		'doc.Close
		Call doc.Close(True)

	Next
	
Next
End Sub


Sub PL(oDoc As Document)
	
	
	'Export Parts List
path_and_name = ThisDoc.PathAndFileName(False) ' without extension
Dim oDoc2 As Inventor.DrawingDocument
oDoc = ThisDoc.Document

Dim oSheet As Inventor.Sheet
'oSheet = oDoc.Sheets(1) ' first sheet
oSheet = oDoc2.Sheets("Sheet:1") ' sheet by name

' say there is a Partslist on the sheet.
Dim oPartslist As PartsList
oPartslist = oSheet.PartsLists(1)

'On Error GoTo handleXLSLock
'Publish document.
' export the Partslist to Excel.
oPartslist.Export(path_and_name & ".xls",PartsListFileFormatEnum.kMicrosoftExcel) 

	

End Sub


'handleXLSLock:
'MessageBox.Show("No XLS", "iLogic")
'Resume Next

  

0 Me gusta
Mensaje 10 de 15

A.Acheson
Mentor
Mentor

Try This

 

I have used sheet name in the excel file sheet, this will help if more than one partslist in the drawing. This required a function for the sheet name to strip out ":" as that will cause an error in the file name.

 

Other than that I have used Active sheet to to get the partslist while looping and then export. 

I have chose to declare the drawing as drawing document in the sub routine but you could do this outside also and bring it in through the call. 

Sub Main


'NNx number count To iterate down excel Row
'FFx Full File path held in column D
'LIST-CU.xlsx column D contains the file path

For NNx = 2 To 4 ' for testing only the top 3 rows are used
	
	'PIX = "A"& NNx
	'BNX = "B"& NNx
	'LBX = "C"& NNx
	'FFX = "D" & NNx	
	
'MessageBox.Show(PIX, "PIX")
' PIZ reads the PI number from column A
' BNZ reads the Browser Name from Column B
' LBZ reads the path of the substitute path
' FFZ reads the path to the Full Fat detailed part

'PIZ = GoExcel.CellValue("LIST-CU.xlsx", "Sheet1", PIX)
'BNZ = GoExcel.CellValue("LIST-CU.xlsx", "Sheet1", BNX)
'LBZ = GoExcel.CellValue("LIST-CU.xlsx", "Sheet1", LBX)

FFZ = GoExcel.CellValue("LIST-CU.xlsx", "Sheet1", FFX)



'MessageBox.Show(PIZ, "PI")
'MessageBox.Show(BNZ, "BN")
'MessageBox.Show(LBZ, "LB")
'MessageBox.Show(FFZ, "FF")


Dim aLIST As New List(Of String)

aLIST.Add(FFZ)

	For Each Str As String In aLIST
	   ' System.Console.WriteLine(Str)
		
		ThisDoc.Launch(Str)

		Dim oDoc As Document = ThisApplication.ActiveDocument
			
		'code inserted here to save as pdf, dwg, dxf & export parts LIST-CU in deskstop folder
				
			If oDoc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
			
				Call PL(Str)
				Call oDoc.Close(True)
			End If
		Next
Next
End Sub


Sub PL(Str As String)
	
Dim oDrawDoc As DrawingDocument 
	
oDrawDoc = ThisApplication.ActiveDocument

Dim ActiveSheet As Sheet
ActiveSheet = oDrawDoc.ActiveSheet
	
	'Export Parts List Path
path_and_name = Left(Str,(Len(Str)-4))
Dim oSheets As Sheets
oSheets = oDrawDoc.Sheets
Dim oSheet As Sheet
'Loop through sheets 
For Each oSheet In oSheets

	' Find Partslist on the Active sheet.
	Dim oPartslist As PartsList
	oPartslist = ActiveSheet.PartsLists(1)

	'[ Use sheet name in parts list name in case more than one is found
	Dim SheetName As String
	SheetName = oSheet.Name
	'use function to remove : from the sheet name as this is not supported in a file name
	Dim SN As String
	SN  = clean_filename(SheetName)
	 ']
	 
	Try
	' export the Partslist to Excel.
	oPartslist.Export(path_and_name &"-" & SN  & ".xls",PartsListFileFormatEnum.kMicrosoftExcel) 
	Catch 
	End Try
	

Next

End Sub


Function clean_filename(SheetName As String)
   Dim replace_with As String
replace_with = ""
   
   Dim inv_chars As String
    Dim cpos As Long

	'Origional List adjust function contents in invchars as needed.
	'"'!""#¤%&/()=?`^*>;:@£${[]}|~\,.'¨´+-"

    invchars = "'!""#¤%&/=?`^*>;:@£${[]}|~\,.'¨´+"
    For cpos = 1 To Len(invchars)
        SheetName = Replace(SheetName, Mid(invchars, cpos, 1), replace_with)
    Next
    clean_filename = SheetName
End Function

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Me gusta
Mensaje 11 de 15

andrew_canfield
Collaborator
Collaborator

Thanks again - there is some success, but just for fun I included a drawing without a parts list - how can a 'no part's list present' skip command be added?

0 Me gusta
Mensaje 12 de 15

A.Acheson
Mentor
Mentor
Solución aceptada

One way is to just put the Partlist object and the Partlist export inside a try catch. This way if it doesn't exist it will go to a catch error and just do nothing and move to the next sheet. 

 

Try
	' Find Partslist on the Active sheet.
	Dim oPartslist As PartsList
	oPartslist = ActiveSheet.PartsLists(1)
	'export the PartsList To Excel.
	oPartslist.Export(path_and_name &"-" & SN  & ".xls",PartsListFileFormatEnum.kMicrosoftExcel) 
	Catch 
	End Try

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Me gusta
Mensaje 13 de 15

andrew_canfield
Collaborator
Collaborator

Hello

The try, catch worked & everything else works to, thanks for the help. Still testing at the minute, have a snag exporting all sheets as pdf's but will be searching for possible solutions next.

Project very nearly completed 🙂 

Regards

 

Andrew

0 Me gusta
Mensaje 14 de 15

andrew_canfield
Collaborator
Collaborator

So far so good, when this line runs, can the option be set to open an .idw deferred?

Looked through Tools>Application Options> File>File Open Options> Drawing/DWG but there only 'skip unresolved' in Inventor 2018. (saw defer as an option on a different post - figure the option isn't in 2018).

		ThisDoc.Launch(Str)

		Dim doc As Document = ThisApplication.ActiveDocument

 Regards

 

Andrew

0 Me gusta
Mensaje 15 de 15

A.Acheson
Mentor
Mentor

Here is a post that can set the drawing to defer as it opens. I am not super familiar with it's functionality so you will have to test. The timer element doesn't work so I removed it , not sure of it's functionality within the rule. 

https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/ilogic-defer-updates-in-drawing-file/td...

 

	If oDoc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
			
			'Toggle 'Defer updates' on and off in a Drawing
			oValue = oDoc.DrawingSettings.DeferUpdates()

				If oValue = "False" Then
				oDoc.DrawingSettings.DeferUpdates = "True"
				oStatusText = "Off"
				Else
				oDoc.DrawingSettings.DeferUpdates = "False"
				oStatusText = "On"
				End If

				'PauseTime = 2
				'Start = Timer
				'Do While Timer < Start + PauseTime
				ThisApplication.UserInterfaceManager.DoEvents
				ThisApplication.StatusBarText = "Drawing Updates " & oStatusText
				'Loop
	
				Call PL(Str)
				Call oDoc.Close(True)
			End If

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Me gusta