Skip to main content

Membuat Borang Dengan Nombor Siri Yang Berturutan Menggunakan MS WORDS 2007

This is a cut and paste article from http://wordribbon.tips.net/T009540_Using_Sequential_Document_Serial_Numbers.html


Using Sequential Document Serial Numbers
by Allen Wyatt (last updated November 20, 2010)

If you have a need to create serial numbers in your documents and they are very simple in nature, you can do so using a macro. This approach to serial numbers is great if your serial numbers are sequential (1, 2, 3, etc.) or regular in their incidence (3, 5, 7, etc.).

To begin, you should enter the macro that will control the change of the serial number and the printing of your document. You can use the following macro:

Sub MySerial()
Dim rngSerialLocation As Range
Dim intSerialNum As Integer
Dim strSerialNum As String
Dim docCurrent As Document
Dim intNumCopies As Integer
Dim intCount As Integer

' set ref to current active doc
Set docCurrent = Application.ActiveDocument
' set ref to the bookmarked serial number
Set rngSerialLocation = docCurrent.Bookmarks("Serial").Range

' get the starting number
intSerialNum = Val(rngSerialLocation.Text)
' get the number of copies required
intNumCopies = Val(InputBox$("How many Copies?", _
"Print Serialized", "1"))

For intCount = 1 To intNumCopies
' print the document
docCurrent.PrintOut Range:=wdPrintAllDocument
' increment the serial number
intSerialNum = intSerialNum + 1
' put into formatted version
strSerialNum = Format(intSerialNum, "00000")
' stuff into proper place
rngSerialLocation.Text = strSerialNum
Next intCount

' reset the bookmark, since the updating procedure
' wipes out the old one
docCurrent.Bookmarks.Add Name:="Serial", _
Range:=rngSerialLocation
End Sub
There is only one prerequisite to using the macro: you need to make sure that your document contains a bookmark named Serial. This bookmark should reference the serial number in your document, as you want it to appear in the first printed document. (When you are through running the macro, you can save the document and the serial number will be ready for the next time you want to use it.)

The macro also assumes that your serial number consists primarily of some numeric value that changes with each iteration. You can modify the incrementing of the serial number, as well as its formatting, in the For...Next loop within the macro.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (9540) applies to MS Word versions: 2007 | 2010


Credit to original author.

Comments

Popular posts from this blog

Jalan Jalan di Cherating

P etang Jumaat yang lalu, akudan kroni kroni pejabat telah berjalan - jalan di Cherating. Seperti biasa acara acara seperti ini memang akan dilakukan setahun 2 kali oleh kroni - kroni ini. Tahun lepas ke genting dan ke Port Dickson. Tapi yang aku pasti, sesen pun aku tak keluarkan utnuk perbelanjaan inui kecuali duit Rokok, Tol dan Petrol sahaja. Aku, Tahir, anak Tahir, dan Fareez bertolak awal dengan rancangan untuk memancing di sana sampai muntah. Tapi malangnya Fareez tak berminat memancing... namun atas dasar kroni, dia terpaksa pergi awal juga sebab ini sahaja team bujang yang tinggal. Mujurlah hj. Sazul tetiba pon ada plan nak pergi awal, maka dapatlah book satu bilik awal untuk Fareez. Kami bertolak daripada PJ kira kira pukul 6.30Ptg atas janji bertolak pukul 5 petang. Dalam perjalanan Fareez buleh pula bertekak dengan girlpren dia dan suruh kitorang semua senyap.. aku rasa panas je... lagi sikit aku nak suruh dia berenti dan turunkan aku sebab awek punya pasal kawan kawan pon

APa itu ikan Lais?

Pertama kali aku balik ke kg Girlfriend aku, bakal pak mentua aku memperkenalkan aku kepada ikan lais. 1st time aku mendengar ikan tersebut. Khabarnya tak banyak sungai di Malaysia yang mempunyai ikan ini. Rasanya sungguh sedap. Ntahlah, mungkin aku nie jenis yg tak memilih makanan, tapi bagi aku ikan lais ini amatlah sedap walaupun aku sendiri belum pernah merasa makan lampam, sebarau, tengas, jelawat kelah apatah lagi. Harap suatu hari ini aku dapat makanlah ikan - ikan ini. Tapi aku tak sangka, ikan lais ini ianya salah satu daripada spesis keli juga. Keli lutsinar. Sebab tu dalam bahasa omputih ianya dipanggil 'Glass Catfish'. Ini gambar ikan tu kalau hidup di dalam akuarium. Bawah ini pulak gambarnya yang telah digoreng di rumah aku. Hmmm tapi sodap laie kalau digoreng di Felda Keratong 3. Hehehe.. Dear my butang... opss tunang.. thank you for the ikan... I lappppppp youuu...

Khalwat? Pretty? and Tudung?

KOTA BARU: A 21-year-old university student was yesterday fined RM1,200 for committing khalwat (close proximity) with one of Kelantan’s imported football stars. Farrah Aina Safian Sauri, 21, from the International Islamic University (IIU), pleaded guilty to committing Source NSTP online : Uouch!... Unbelieveable.. how can a cute girl like this been cought for khalwat offence? By looking at her face and style, i though she at least an ordinary good girl. Pity her, why she need to do such act? It is true what people always said.. 'don't judge books by its cover', kekeke.. chances for cute girl like her to become 2nd hand stuff is quite high. That's why some of elders i met said a girl which not have pretty face, may be pretty at other hers other side, because no one will touch it. (But I don't agree with the quote 100%, because i once had saw unpretty girl who had unpretty attitude and may contribute for being 2nd hand stuff :p) I know girls with 'tudung'