标记,
让我们一步一步地完成它,这样您就可以从中得到您想要的东西。
我们从SheetSetForm.SSStartHere.开始
这是检查您是否有一个工作表设置为打开状态,并确保只有一个是打开的。
它将锁定它,然后将其发送到Loop穿透SheetsPop
这是我们获取要呈现给用户以进行更改的值的地方。
请注意,GetCSSProperties正在发送一个字符串和一个工作表。该字符串是自定义工作表属性的EXACT Title。
您可以根据公司的自定义工作表属性自定义整个表单。
让我们假设某些值已更改并且用户点击OK按钮。该代码将我们发送到SetProps。
此例程检查一个且仅一个工作表集并锁定它。
因为这东西正在将工作表集的内容导出到Excel以在另一个办公室导入,所以我们现在将跳过它。
SetProps将我们发送到Loop穿透SheetsSet,它将执行此操作。
它将遍历所有工作表并将值设置为表单中的值。
- Private Sub LoopThroughSheetsSet(ByVal compEnum As IAcSmEnumComponent)
- Dim comp As IAcSmComponent
- Dim lastrevn As Variant
- Dim lyOut As AcSmAcDbLayoutReference
- Dim lyName As String
- Dim lastrevd As String
- Dim lastrevdate As String
- Dim rNumTemp As String
- Dim rnNext As String
- Dim rnVar As Variant
- Dim dirmade As Boolean
- Dim tLine1 As String
- Dim tLine2 As String
- Dim tLine3 As String
- Dim selsets As AcSmSheetSelSets
- Dim selset As AcSmSheetSelSet
- Dim tselset As AcSmSheetSelSet
- Dim ssMade As Boolean
- Dim ttitle As String
- Dim repTemp As String
- On Error GoTo ErrHandler
- ssMade = False
- Set comp = compEnum.Next()
- dirmade = False
- ' loop through till the component is Nothing
- Do While Not comp Is Nothing
- 'if the component is a sheet, then...
- If comp.GetTypeName = "AcSmSheet" Then
- 'loop through all the sheets.
- 'Call LoopThroughSheetsPop(sset.GetSheetEnumerator)
- Dim s As AcSmSheet
- Set s = comp
- Dim sNumber As String
- Dim sTitle As String
- sNumber = s.GetNumber
- 'tLine1 = GetCSSProperties("Drawing Title Line 1", s)
- 'tLine2 = GetCSSProperties("Drawing Title Line 2", s)
- 'tLine3 = GetCSSProperties("Drawing Title Line 3", s)
- 'If tLine1 = "%%032" Then
- ' tLine1 = ""
- 'End If
- 'If tLine2 = "%%032" Then
- ' tLine2 = ""
- 'End If
- 'If tLine3 = "%%032" Then
- ' tLine3 = ""
- 'End If
- 'If Not tLine1 = "" Then
- ' If Not tLine2 = "" Then
- ' If Not tLine3 = "" Then
- ' ttitle = tLine1 & " " & tLine2 & " " & tLine3
- ' Else
- ' ttitle = tLine1 & " " & tLine2
- ' End If
- ' Else
- ' If Not tLine3 = "" Then
- ' ttitle = tLine1 & " " & tLine3
- ' Else
- ' ttitle = tLine1
- ' End If
- ' End If
- 'Else
- ' If Not tLine2 = "" Then
- ' If Not tLine3 = "" Then
- ' ttitle = tLine2 & " " & tLine3
- ' Else
- ' ttitle = tLine2
- ' End If
- ' Else
- ' If Not tLine3 = "" Then
- ' ttitle = tLine3
- ' End If
- ' End If
- 'End If
- '
- 'If Not ttitle = "" Then
- ' s.SetTitle ttitle
- 'End If
- sTitle = s.GetTitle
- Set lyOut = s.GetLayout
- lyName = lyOut.ResolveFileName
- If sNumber = dNum Then
- If Not pstamp = "" Then
- ChangeProperties "Preliminary Stamp", pstamp, s
- End If
- If Not pLines = "" Then
- ChangeProperties "ProjectLayer", pLines, s
- End If
- If Not tLines = "" Then
- ChangeProperties "TitleLayer", tLines, s
- End If
- If Not ssetName = "" Then
- newSelSet.Add s
- End If
- If Not chk = "" Then
- ChangeProperties "Checked By", chk, s
- End If
- If Not des = "" Then
- ChangeProperties "Designed By", des, s
- End If
- If Not chrg = "" Then
- ChangeProperties "In Charge Of", chrg, s
- End If
- If Not dwn = "" Then
- ChangeProperties "Drawn By", dwn, s
- End If
- If Not scl = "" Then
- ChangeProperties "Scale", scl, s
- End If
- If Not ptitle = "" Then
- ChangeProperties "Location", ptitle, s
- 'ChangeProperties "Drawing Title Line 1", ptitle, s
- End If
- If Not repTxt = "" Then
- repTemp = PropReplaceCombo.Column(0, PropReplaceCombo.ListIndex)
- ChangeProperties repTemp, repTxt, s
- End If
|