各位大神,小弟初來乍到,對編程不怎么懂,望各位大神不吝賜教。
小弟在公安系統作業,因文書寫作實在麻煩,同樣的資訊每次得寫四遍,煩不勝煩。望大神幫忙寫一段VB代碼,方便完成列印文書。
表單設計如下:
表單1

表單2

想讓表單1文本框中的所輸入的內容,按預覽按鈕后,在表單2的橫線上相應的顯示出來。然后再按列印按鈕,將表單2所顯示的內容以A4紙張大小列印出來。
1、紅框中的日期能自動生成。
2、紅框中的編號能自動生成,依次遞增。
望大神不吝賜教,萬分感謝!
uj5u.com熱心網友回復:
Dim d as Date
Dim Y as Integer
Dim M as Integer
Dim D as Integer
Dim No as Long
d=Now
Y=Year(d)
M=Month(d)
D=Day(d)
f=FreeFile()
Open "No.txt" for input as #f
Input #f,No
Close #f
No=No+1
Open "No.txt" for output as #f
Print #f,No
Close #f
uj5u.com熱心網友回復:
如果“不會”,就從基礎的書箱開始學習…………想做“伸手黨”?
說吧,預算是多少…………
uj5u.com熱心網友回復:
作業太忙,回家很晚,各位親看我發帖都是凌晨了。
還是希望各位大神伸出援助之手。
uj5u.com熱心網友回復:
感謝老師,原來在學校學過一點皮毛,參加作業后幾乎忘光了。現在作業中用到了,想重拾,感覺力不從心!
uj5u.com熱心網友回復:
沒有必要用VB寫,用Word中的VBA寫。我以前作業中遇到類似的問題,就是用Word的VBA寫的。uj5u.com熱心網友回復:
看不懂啊,基礎太差了。uj5u.com熱心網友回復:
文本框設定為沒有邊框,下面用line控制元件畫一條線。其余用labeluj5u.com熱心網友回復:
如果是我,不用控制元件,直接用Form1.Form1.Print、Form1.Line、……
CurrentX, CurrentY Properties
Applies To See Also
Specifies the horizontal (X) and vertical (Y) coordinates for the next drawing method. Not available at design time; read-write at run time.
Syntax
Object.CurrentX[ = nXCoord]
Object.CurrentY[ = nYCoord]
Settings
nXCoord
Specifies the horizontal coordinate of the form, in the unit of measurement specified by the ScaleMode property of the form.
nYCoord
Specifies the vertical coordinate of the form, in the unit of measurement specified by the ScaleMode property of the form.
Remarks
Coordinates are measured from the upper-left corner of an object. CurrentX is 0 at an object's left edge and CurrentY is 0 at its top edge. Coordinates are expressed in foxels or the current unit of measurement defined by the ScaleMode property.
When you use the following graphics methods, the CurrentX and CurrentY settings are changed as indicated.
Method CurrentX, CurrentY set to
Box The endpoint of the box as specified by the last two arguments.
Circle The center of the object.
Cls 0, 0.
Line The endpoint of the line.
Print The next print position.
Pset The point drawn.
FontSize 屬性
回傳或設定在控制元件中或在運行時畫圖或列印操作中,顯示文本所用的字體的大小。
注意 包含 FontSize 屬性是為了和 CommonDialog 控制元件一起使用,以及與以前的 Visual Basic 版本兼容。對于其它的功能,請使用新的 Font 物件屬性(對 CommonDialog 控制元件不可用)。
語法
object.FontSize [= points]
FontSize 屬性語法包含下面部分:
部分 描述
object 物件運算式,其值是“應用于”串列中的一個物件。
points 數值運算式,用磅為單位指定所用字體的大小。
說明
用該屬性以所要的字體格式化文本。預設值由系統決定。要改變預設值,以磅為單位指定字體尺寸。
FontSize 的最大值為 2160 磅。
注意 Visual Basic 中可用的字體取決于系統的配置、顯示設備和列印設備。與字體相關的屬性只能設定為真正存在的字體的值。
一般來說,用 FontSize、FontBold、FontItalic、FontStrikethru 和 FontUnderline 屬性來設定大小和樣式屬性前,應該先改變 FontName 屬性。然而,在設定 TrueType 字體尺寸小于 8 磅時,應用 FontSize 屬性來設定字體大小,然后設定 FontName 屬性,用 FontSize 屬性再一次設定字體大小。Microsoft Windows 運行環境對于小于 8 磅的 TrueType 字體使用不同的字體。
uj5u.com熱心網友回復:
簡單一點,你的在word里面先做一個基礎的模板。把需要替換的地方用特征字串寫在那里,比如 %姓名% %性別% 啥的,接下來寫個宏,輸入姓名字串,然后搜索 %姓名%替換為你輸入的姓名字串,以此類推。uj5u.com熱心網友回復:
直接放出我寫的東西吧:http://download.csdn.net/download/vbtoy/10050623
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/52843.html
標籤:VB基礎類
上一篇:打包之后出現資料庫錯誤
