- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Can anyone help me with some code to Export a revision history table. I know how to designate the location and filename but I cannot seem to figure out the command line that actually executes the exportation.
End goal is to get the whole revision history table into an excel doc named the same as the file it came from via one button in a form.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
This rule exports the revision table to excel
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
Dim oOptions As NameValueMap 'see below for additional options
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oOptions.Value("AutoFitColumnsWidth") = 1
Dim oRevTable As RevisionTable
oRevTable = oDrawDoc.ActiveSheet.RevisionTables.Item(1)
oRevTable.Export(ThisDoc.PathAndFileName(False) & ".xls", kMicrosoftExcelFormat,oOptions )
For more information about the options you can add:
RevisionTable.Export Method
RevisionTable.Export Method
Parent Object: RevisionTable
Description
Saves the revision table to an external file.
Syntax
RevisionTable.Export( FileName As String, FileFormat As FileFormatEnum, [Options] As Variant )
Parameters
| Name | Description | |||||||||||||||||||||
| FileName | Input string that specifies the file name to export the revision table to. | |||||||||||||||||||||
| FileFormat | Input FileFormatEnum that specifies the file format to save to. | |||||||||||||||||||||
| Options | Optional input NameValueMap object that specifies additional options for export. Valid inputs are listed in the table below.
|
please feel free to "kudos"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I tried the ilogic. I get this pop-up.
Now i am able to get around this window and it asks me to make a save as copy and then asks me for a location.
Works but just as many steps as export clicking the rev table.
I know how to point a directory but i can seem to get around this error and it is stopping the file from exporting to a location i want in one click.
Thanks for the help this far though, closest I have gotten in over a year.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I've noticed that the drawingdocument should be saved first, otherwise it cannot create a file and then you get the error.
You could workaround by saving the excel in your workspace.
The other problem is that the xls extension should be xlsx
Then it works perfect
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
Dim oOptions As NameValueMap 'see below for additional options
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oOptions.Value("AutoFitColumnsWidth") = 1
Dim oRevTable As RevisionTable
oRevTable = oDrawDoc.ActiveSheet.RevisionTables.Item(1)
oRevTable.Export(ThisDoc.PathAndFileName(False) & ".xlsx", kMicrosoftExcelFormat)
please feel free to "kudos"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This did work, Thanks!
Still wasn't able to get the auto-fit to work for some reason but that is super minor.
If anyone is looking for the expanded ilogic here is how to give it a file name and a location.
SyntaxEditor Code Snippet
Try 'oPath = set Export Path location oPath = "C:\_CADD" 'Set Values 'Defines filename. Is directly linked to Part Number for Drawing.Sets other data values. oTableNumber = iProperties.Value("Project", "Part Number") oFileName = ThisDoc.FileName(False) 'without extension oDocument = ThisApplication.ActiveDocument oDataMedium = ThisApplication.TransientObjects.CreateDataMedium oRevTable = oDocument.ActiveSheet.RevisionTables.Item(1) oOptions = ThisApplication.TransientObjects.CreateNameValueMap 'get target folder path oFolder = oPath & "\" & "For_Import" 'Check for the Target folder. If it exists, do nothing. If it does not exist, create it. If Not System.IO.Directory.Exists(oFolder) Then System.IO.Directory.CreateDirectory(oFolder) End If 'Set the target file name oDataMedium.FileName = oFolder & "\" & oTableNumber & "-TempRevTable" & ".xlsx" oExportName = oDataMedium.FileName 'Export Rev Table document oOptions.Value("AutoFitColumnsWidth") = 1 oRevTable.Export(oExportName, kMicrosoftExcelFormat,oOptions) Beep() i = MessageBox.Show("Revison Table successfully exported!", "Revison Table Export", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1) Catch MessageBox.Show("No Revison Table Found.", "iLogic - Warning") End Try