මුලින්ම word වල view
ටැබ් එකට යන්න.ඊට පස්සේ ඒකෙ macros කියන menu එකෙන් view macros තෝරන්න.
ඒ එන
window එකේ Macro name එක විදියට NewMacros දීලා අලුත් macro එකක් create කරගන්න
ඒත් එක්කම visual basic editor එක open වේවි.එකේ තියෙන code එක මකල පහල තියෙන code එක ඒකට paste කරලා save කරලා macro එක close කරන්න
UserForm1.Show
End Sub
ඊට පස්සේ form වල right click කරලා insert වල userform කියන එක තෝරන්න.දැන් අපි පොඩි interface එකක් design කරන්න යන්නේ
Userform එකට text box එකක් ,labels දෙකක්, spin button එකක් සහ command buttons දෙකක් add කරගන්න.layout එක පහල විදියට හදාගන්න
ඊට පස්සේ එක එක component එක උඩ click කරලා properties menu එකේ caption කියන තැනින් මේවාගේ text edit කරන්න.පහල විදියට
spin control එකේ properties වල Max: 150 (ඒ කියන්නේ 15cm ), Min: 20 , Value: 50විදියට වෙනස් කරගන්න.
දැන් text box එකේ properties වල Value: 5 , Locked : True විදියට වෙනස් කරගන්න.
දැන් code කරන්න පටන් ගන්න යන්නේ.හැම component එක උඩම double click කලාම code coding window එක open වෙනවා.එකේ Sub සහ End Sub code line දෙක මැද code කරන්න.code කරලා save කරලා exit කරන්න
Spin Control code:
TextBox1.Value = SpinButton1.Value / 10
Exit button code:
Unload me
Unload me
Resize Images button code:
Dim insertedPicture As InlineShape
Dim insertedShape As Shape
Dim imgMult As Single
imgMult = TextBox1.Value * 28.34
For Each insertedPicture In ActiveDocument.InlineShapes
insertedPicture.Select
insertedPictureHeight = insertedPictureHeight * imgMult / insertedPicture.Width
insertedPicture.Width = imgMult
Next
For Each insertedShape In ActiveDocument.Shapes
insertedShape.Select
insertedShape.Height = insertedShape.Height * imgMult / insertedShape.Width
insertedShape.Width = imgMult
Next
Unload Me
දැන් වැඩේ ගොඩ.visual basic editor එකේ ඔක්කොම close කරලා word doc එකට යන්න.imagesම ටික ඔක්කොම add කරගන්න.add කරලා ඔක්කොම select කරගන්න.දැන් view
ටැබ් එකට යන්න.ඊට පස්සේ ඒකෙ macros කියන menu එකෙන් view macros තෝරන්න.
දැන් අපි හැදුව resize images macro එක run කරන්න
දැන් අපි හැදුව form එක පෙන්නනවා.දැන් resize වෙන්න ඕනේ පළල cm වලින් තෝරන්න.ඊට පස්සේ
resize කරන්න.එල නේද?මෙන්න result
resize කරන්න.එල නේද?මෙන්න result
0 comments:
Post a Comment
Leave a comment...