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 ......
一个CommonDialog,一个CommandButton,一个PictureBOX
Option Explicit
Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, B ......
1. 利用资源文件保存国际化列表
2.“外接程序”--“外接程序管理器”--“VB6 资源编辑器”就可以编辑资源文件
3.部分代码
'窗体加载
Private Sub Form_Load()
Dim LocaleID As Long
LocaleID = GetSystemDefaultLCID
Select Case LocaleID
'英文
......
虽然在VB里实现XP风格很简单,但是要使用XP风格同时又让按钮显示图片,则实现起来要麻烦一些,为此,我写了一个控件来实现前述功能,同时让读者可以从中了解XP主题界面的绘制过程。
使用办法很简单,在VB里新建一个工程,然后添加一个控件模块,粘贴以下代码,再将控件放置到窗口即 ......
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 ......