VB调整Excel格式
Private Sub Cmd_OK_Click()
Dim ExcelAppX As Excel.Application
Dim ExcelBookX As Excel.Workbook
Dim ExcelSheetX As Excel.Worksheet
Dim a(1 To 3) As Single
Dim strFormat As Variant
a(1) = 7.3456
a(2) = 2.43
a(3) = 0
strFormat = "¥#,##0." & String(CLng(TxTNumber.Text), "0") & ";¥-#,##0." & String(CLng(TxTNumber.Text), "0")
Set ExcelAppX = CreateObject("Excel.Application")
Set ExcelBookX = ExcelAppX.Workbooks().Add(App.Path & "\a.xls")
ExcelAppX.Visible = True
Set ExcelSheetX = ExcelBookX.Worksheets("Sheet1")
ExcelSheetX.Cells(1, 1).Value = a(1)
ExcelSheetX.Cells(1, 2).Value = a(2)
ExcelSheetX.Cells(1, 3).Value = a(3)
ExcelSheetX.Cells(1, 1).NumberFormatLocal = strFormat
ExcelSheetX.Cells(1, 2).NumberFormatLocal = strFormat
ExcelSheetX.Cells(1, 3).NumberFormatLocal = strFormat
ExcelAppX.Application.Visible = True
ExcelSheetX.PrintPreview
ExcelAppX.DisplayAlerts = False
Set ExcelAppX = Nothing
Set ExcelBookX = Nothing
Set ExcelSheetX = Nothing
End Sub
相关文档:
Dim p(10000, 1) As Double
Dim num As Integer
Dim ptx As Single
Dim pty As Single
Dim w0, w1, w2, w3 As Single
Private Sub Command1_Click()
Dim t As Single
Dim i As Integer
Dim f0, f1, f2, f3 As Single
Picture1.DrawWidth = 3
For t = 0 To 1 St ......
访问远程数据库的情况有以下几种:
1)访问远程数据库的access数据库
2)访问远程mssql数据库或oracle等其他关系数据库,但是数据库通信端口被防火墙阻挡或其他网络原因造成无法使用该端口
本文仅在windows2000 advance server,mdac2.8下测试通过,其余条件不保证能正常运行
在mdac的Service Providers中包括Microsoft ......
http://zhidao.baidu.com/question/33440250.html
在模块中输入以下代码
Public Declare Function sndPlaySound Lib "winmm" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
' flag uitzetten
Public Const SND_SYNC = &H0
Public Const SND_ASYNC = &H1 ......
VB根据窗口标题获取应用程序完整路径(来自网络)
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId A ......