⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ubianhan.ctl

📁 公文管理系统》是一套通过行文收发
💻 CTL
📖 第 1 页 / 共 2 页
字号:
               ColumnWidth     =   599.811
            EndProperty
            BeginProperty Column01 
               ColumnWidth     =   3000.189
            EndProperty
            BeginProperty Column02 
               ColumnWidth     =   4199.811
            EndProperty
            BeginProperty Column03 
               Object.Visible         =   0   'False
               ColumnWidth     =   1365.165
            EndProperty
         EndProperty
      End
      Begin VB.Label lblLabels 
         Alignment       =   1  'Right Justify
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H8000000A&
         Caption         =   "标题:"
         ForeColor       =   &H80000008&
         Height          =   180
         Index           =   0
         Left            =   120
         TabIndex        =   11
         Top             =   1470
         Width           =   450
      End
      Begin VB.Label lblLabels 
         Alignment       =   1  'Right Justify
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H8000000A&
         Caption         =   "内容:"
         ForeColor       =   &H80000008&
         Height          =   180
         Index           =   1
         Left            =   120
         TabIndex        =   10
         Top             =   2670
         Width           =   450
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H8000000A&
         Caption         =   "便函"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   21.75
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000FF&
         Height          =   435
         Left            =   1020
         TabIndex        =   9
         Top             =   480
         Width           =   5055
      End
      Begin VB.Line Line1 
         BorderColor     =   &H008080FF&
         BorderWidth     =   2
         X1              =   690
         X2              =   6060
         Y1              =   1200
         Y2              =   1200
      End
   End
End
Attribute VB_Name = "UBianHan"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Public pIP As String
Public pConn As String
Dim strUserName As String

Private Sub Form_Unload(Cancel As Integer)
  Screen.MousePointer = vbDefault
End Sub

Private Sub cmdPrint_Click()
    Dim oWrd As Object
    Set oWrd = CreateObject("Word.Application")
    oWrd.Visible = True
    oWrd.Activate
    oWrd.Documents.Add

'    With oWrd.ActiveDocument.PageSetup
'        .TopMargin = 157.65
'        .BottomMargin = 72
'        .LeftMargin = 89.85
'        .RightMargin = 89.85
'        .HeaderDistance = 42.55
'        .FooterDistance = 72
'        .PageWidth = 595.3
'        .PageHeight = 841.9
'    End With
    
    oWrd.ActiveDocument.PageSetup.LinesPage = 24
    
    
    With oWrd.Selection
      
      .ParagraphFormat.Alignment = 1
      .ParagraphFormat.SpaceBefore = 120
      .ParagraphFormat.LeftIndent = 39
      .ParagraphFormat.RightIndent = 39

      .Font.Size = 16    '三号
      .Font.Name = "宋体"
      .Font.Bold = True
      .TypeText txtFields(0).Text
      .TypeParagraph
            
      .ParagraphFormat.Alignment = 3
      .ParagraphFormat.SpaceBefore = 0
      .ParagraphFormat.LeftIndent = 0
      .ParagraphFormat.RightIndent = 0
      
      .Font.Size = 14     '四号
      .Font.Name = "宋体"
      .Font.Bold = False
      .TypeParagraph

      .TypeText txtFields(1).Text
      .TypeParagraph
      .Sections(1).Footers(1).PageNumbers.Add PageNumberAlignment:=1, FirstPage:=False
    End With

    oWrd.ActiveWindow.ActivePane.View.Type = 3
    oWrd.ActiveWindow.ActivePane.View.SeekView = 9

'    Selection.EndKey Unit:=wdLine, Extend:=wdExtend
     
    With oWrd.Selection.ParagraphFormat
        .Borders(-3).LineStyle = 0
    End With

'
'    oWrd.Selection.TypeText Text:="页眉"
'    oWrd.Selection.ParagraphFormat.Alignment = 3
    oWrd.ActiveWindow.ActivePane.View.SeekView = 0
'    oWrd.PrintOut 0
    
    oWrd.Selection.HomeKey unit:=6

    Set oWrd = Nothing
End Sub

Private Sub datPrimaryRS_Error(ByVal ErrorNumber As Long, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, fCancelDisplay As Boolean)
  '错误处理程序代码置于此处
  '想要忽略错误,注释掉下一行
  '想要捕获它们,在此添加代码以处理它们
  MsgBox "Data error event hit err:" & Description
End Sub

Private Sub datPrimaryRS_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
  '为这个 recordset 显示当前记录位置
  datPrimaryRS.Caption = "记录: " & CStr(datPrimaryRS.Recordset.AbsolutePosition)
End Sub

Private Sub datPrimaryRS_WillChangeRecord(ByVal adReason As ADODB.EventReasonEnum, ByVal cRecords As Long, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
  '验证代码置于此处
  '下列动作发生时该事件被调用
  Dim bCancel As Boolean

  Select Case adReason
  Case adRsnAddNew
  Case adRsnClose
  Case adRsnDelete
  Case adRsnFirstChange
  Case adRsnMove
  Case adRsnRequery
  Case adRsnResynch
  Case adRsnUndoAddNew
  Case adRsnUndoDelete
  Case adRsnUndoUpdate
  Case adRsnUpdate
  End Select

  If bCancel Then adStatus = adStatusCancel
End Sub

Private Sub cmdAdd_Click()
  On Error GoTo AddErr
  datPrimaryRS.Recordset.AddNew

  Exit Sub
AddErr:
  MsgBox Err.Description
End Sub

Private Sub cmdDelete_Click()
  On Error GoTo DeleteErr
  With datPrimaryRS.Recordset
    .Delete
    .MoveNext
    If .EOF Then .MoveLast
  End With
  Exit Sub
DeleteErr:
  MsgBox Err.Description
End Sub

Private Sub cmdRefresh_Click()
  '只有多用户应用程序需要
  On Error GoTo RefreshErr
  datPrimaryRS.Refresh
  Exit Sub
RefreshErr:
  MsgBox Err.Description
End Sub

Private Sub cmdUpdate_Click()
  On Error GoTo UpdateErr

  datPrimaryRS.Recordset.UpdateBatch adAffectAll
  Exit Sub
UpdateErr:
  MsgBox Err.Description
End Sub

Private Sub UserControl_Initialize()
        pConn = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=OA;Data Source=lzy"
    
    strUserName = GetSetting("JGYOA", "Login", "UserName", "")
    With datPrimaryRS
        .ConnectionString = pConn
        .RecordSource = "select ID,标题,内容,username from 便函 where username='" & strUserName & "'"
        .Refresh
    End With
End Sub

Private Function Title(ts As String) As String
    Dim rs As New ADODB.Recordset
    Dim a, b As String
    
    rs.Open "select * from 公文格式表 where 公文类别 = '" & ts & "'", pConn, adOpenDynamic, adLockReadOnly
    a = rs.Fields("单位名称").Value
    b = rs.Fields("公文类别").Value
    rs.Close
    Set rs = Nothing
    Title = a & b
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -