Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- '**
- ' Populate the 'comChooseDocument' combobox every time the 'frmChooseDocument' user form is shown
- '*
- Private Sub UserForm_Activate()
- '** Turn off screen updating so that the user is oblivious *'
- Application.ScreenUpdating = False
- '** Remove all items currently in the combobox *'
- Dim i As Integer
- For i = 1 To Me.comChooseDocument.ListCount
- Me.comChooseDocument.RemoveItem 0
- Next i
- '** Get all of the 'heading 1' new starter documents titles to add to the combobox (do this every time in case the doucment has changed)*'
- Dim headings() As String
- headings = Functions.GetHeadings
- '** Loop through each 'heading' and add it to the combobox *'
- Dim heading As Variant
- For Each heading In headings
- Me.comChooseDocument.AddItem heading
- Next
- '** Turn the screen updating back on *'
- Application.ScreenUpdating = True
- '** Set the combobox to the first entry, so that there is never a blank selection *'
- If Not Me.comChooseDocument.ListCount = 0 Then
- Me.comChooseDocument.ListIndex = 0
- Else
- Me.Hide
- MsgBox "Sorry, there is no valid 'Heading 1' styled text within your document." & vbCrLf & vbCrLf & "Please ensure that the heading of any new starter document that you wish to export is styled as 'heading 1' and try again.", vbInformation, "No New Starter Documents Found"
- End If
- End Sub
- '**
- ' Ensure that the 'comChooseDocument' has a value before enabling the 'OK' button
- '*
- Private Sub comChooseDocument_Change()
- '** Check to see if the combobox has s value *'
- If Not comChooseDocument.value = "" Then
- btnOK.Enabled = True
- Else
- btnOK.Enabled = False
- End If
- End Sub
- '**
- ' Hide the 'frmChooseDocument' user from if the user clicks 'Cancel'
- '*
- Private Sub btnCancel_Click()
- Me.Hide
- End Sub
- '**
- ' Start the document export process when the user clicks 'OK'
- '*
- Private Sub btnOK_Click()
- Me.Hide
- '** Attempt to export the document as selected by the user *'
- Dim result As Boolean
- result = Functions.StartExportDocument(comChooseDocument.value)
- '** Check to see if the export process was successful *'
- Call Functions.CheckResult(result)
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement