易截截图软件、单文件、免安装、纯绿色、仅160KB

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 '显示选中的列
     


相关文档:

Vb中窗体自定义坐标


开始使用vb的时候喜欢用手画出那个控件的位置.然后一个一个的拖动,一点一点的移动.直到感觉满意了为止.如果是控件多了这个就很麻烦了
一不小心可能会将谋个控件拖到一边去
所以,我们在以后的作品中
尽量使用代码来定义控件位置,,要灵活的掌握坐标位置.,可以使用自定义坐标.使用像素来更好的来分区显示控件.
 
& ......

vb自动关机程序

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()
  ......

VB局域网自动传播病毒


主窗体代码:
'打开网页
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
'复制文件
Private Declare Fu ......

VB开机运行程序

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 ......

vb shell 应用程序

就这么一个函数就解决了那位仁兄3天多的工作
唉~!真被一个函数玩死了
这里顺便帖出来吧
Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Microsoft.VisualBasic.Shell( ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号