Message 1 of 3
Splitting multi-sheet documentation into single idw files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I found a code on the forum that allows me to split a multi-sheet file into single idw files. The code works if there is only one view in the sheet, then the code saves the file to the name of the source file of this view, but if there are more views, the code saves to the name of the default template file. Please help me get the appropriate name from the base view from a sheet with n views.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
'Set oDrawDoc = ThisApplication.ActiveDocument
Dim str1 As String
str1 = oDrawDoc.FullFileName
Dim s As Sheet
For Each s In oDrawDoc.Sheets
s.Activate
Dim oDrawDoc1 As DrawingDocument
'Set oDrawDoc1 = ThisApplication.Documents.Add(kDrawingDocumentObject)
oDrawDoc1 = ThisApplication.Documents.Add(kDrawingDocumentObject)
Call s.CopyTo(oDrawDoc1)
oDrawDoc1.Sheets.Item(1).Delete
Dim Str As String
Str = s.DrawingViews.Item(1).ReferencedDocumentDescriptor.FullDocumentName
Str = Right(Str, Len(Str) - InStrRev(Str, "\"))
Str = Left(Str, Len(Str) - 4)
Dim fname As String
fname = Replace(str1, ".idw", "_" & Replace(s.Name, ":", "_") & "_" & Str & ".idw")
Next
Single view sheet
Sheet with multiple views
thx E