vb记录集数据导入到excel
Public Sub DGToExcel(DataGrid1 As DataGrid, Optional ProgressBar1 As ProgressBar, Optional ByVal intFirst As Integer, Optional ByVal intLast As Integer, Optional strTitle As String)
'--将DataGrid导出至Excel,ProgressBar1为进度条,intFirst为从哪一列开始打印,intLast为打印到哪一列
On Error Resume Next
Dim I As Long
Dim J As Integer
Dim K As Integer
Dim sLast As String
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = New Excel.Application
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
xlSheet.Name = "查询结果"
xlApp.Visible = False '--先隐藏
ProgressBar1.Value = 0
Screen.MousePointer = 11
ProgressBar1.Max = DataGrid1.ApproxCount + 3
'--设置标题
sLast = Chr(Asc("A") + intLast - intFirst)
xlApp.Range("A1:" & sLast & "2").Select
With xlApp.Selection '--合并单元格
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
End With
ProgressBar1.Value = 1
xlApp.Selection.Merge
With xlApp.Selection.Font '--字体
.FontStyle = "加粗"
.SIZE = 24
End With
xlApp.Range("A1:" & sLast & "2").Select
xlApp.ActiveCell.FormulaR1C1 = strTitle
ProgressBar1.Value = 2
'--设置列
For K = 0 To intLast - intFirst '显示选中的列
相关文档:
Option Explicit
Private rsMain As ADODB.Recordset
Private rsTerm As ADODB.Recordset
Private strSql As String
Private Sub cmdAbout_Click()
frmAbout.Show
End Sub
Private Sub cmdAddObject_Click() '程序段
......
转自:http://www.52arm.com/Article_Show.asp?ArticleID=186
作者:weidian ---本站原创 点击数:4721 发表时间:2008-5-7 编辑:sanzang
Winsock控件建立在TCP、UDP协议的基础上,完成与远程计算机的 ......
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Private Const EWX_LOGOFF = 0
Private Const EWX_SHUTDOWN = 1
Private Const EWX_REBOOT = 2
Private Const EWX_FORCE = 4
Private closeTime As String
Sub AdjustTokenPrivilegesForNT()
......
程序隐形的原理
对于一个隐形程序而言,最基本的要求是:
1. 不在桌面出现界面;
2. 不在任务栏出现图标;
3. 程序名从任务管理器名单中消失。
Public Declare Function GetCurrentProcessId Lib “kernel32” () As Long
’获得当前进程ID函数的声明
Public Declare Functio ......
Option Explicit
Public Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Public Declare Function RegCreateKey Lib "advapi32.dll" Alias ......