ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[¤À¨É] VBA»y¥y¶°200¥y (1-2)

[¤À¨É] VBA»y¥y¶°200¥y (1-2)

¹Ïªí
(70) ActiveSheet.ChartObjects.Count 'Àò¨ú·í«e¤u§@ªí¤¤¹Ïªíªº­Ó¼Æ
(71) ActiveSheet.ChartObjects(¡uChart1¡v).Select ¡y¿ï¤¤·í«e¤u§@ªí¤¤¹ÏªíChart1
(72) ActiveSheet.ChartObjects(¡uChart1¡v).Activate
ActiveChart.ChartArea.Select ¡y¿ï¤¤·í«e¹Ïªí°Ï°ì
(73) WorkSheets(¡uSheet1¡v).ChartObjects(¡uChart2¡v).Chart. _
ChartArea.Interior.ColorIndex=2 ¡y§ó§ï¤u§@ªí¤¤¹Ïªíªº¹Ïªí°ÏªºÃC¦â
(74) Sheets(¡uChart2¡v).ChartArea.Interior.ColorIndex=2 ¡y§ó§ï¹Ïªí¤u§@ªí¤¤¹Ïªí°ÏªºÃC¦â
(75) Charts.Add ¡y²K¥[·sªº¹Ïªí¤u§@ªí
(76) ActiveChart.SetSourceData Source:=Sheets(¡uSheet1¡v).Range(¡uA1:D5¡v), _
PlotBy:=xlColumns ¡y«ü©w¹Ïªí¼Æ¾Ú·½¨Ã«ö¦C±Æ¦C
(77) ActiveChart.Location Where:=xlLocationAsNewSheet ¡y·s¹Ïªí§@¬°·s¹Ïªí¤u§@ªí
(78) ActiveChart.PlotArea.Interior.ColorIndex=xlNone ¡y±Nø¹Ï°ÏÃC¦âÅܬ°¥Õ¦â
(79) WorkSheets(¡uSheet1¡v).ChartObjects(1).Chart. _
Export FileName:=¡uC¡GMyChart.gif¡v,FilterName:=¡uGIF¡v ¡y±N¹Ïªí1¾É¥X¨ìC½L¤W¨Ã©R¦W¬°MyChart.gif

µ¡Åé
(80) MsgBox ¡uHello!¡v '®ø®§®Ø¤¤Åã¥Ü®ø®§Hello
(81) Ans=MsgBox(¡uContinue?¡v,vbYesNo) '¦b®ø®§®Ø¤¤ÂIÀ»¡u¬O¡v«ö¶s¡A«hAns­È¬°vbYes¡FÂIÀ»¡u§_¡v«ö¶s¡A«hAns­È¬°vbNo¡C
If MsgBox(¡uContinue?¡v,vbYesNo)<>vbYes Then Exit Sub 'ªð¦^­È¤£¬°¡u¬O¡v¡A«h°h¥X
(82) Config=vbYesNo+vbQuestion+vbDefaultButton2 '¨Ï¥Î±`¶qªº²Õ¦X¡A½á­È²ÕConfigÅܶq¡A¨Ã³]¸m²Ä¤G­Ó«ö¶s¬°¯Ê¬Ù«ö¶s
(83) MsgBox ¡uThis is the first line.¡v & vbNewLine & ¡uSecond line.¡v '¦b®ø®§®Ø¤¤±j¨î´«¦æ¡A¥i¥ÎvbCrLf¥N´ÀvbNewLine¡C
(84) MsgBox "the average is :"&Format(Application.WorksheetFunction.Average(Selection),"#,##0.00"),vbInformation, "selection count average" & Chr(13) 'À³¥Î¤u§@ªí¨ç¼Æªð¦^©Ò¿ï°Ï°ìªº¥­§¡­È¨Ã«ö«ü©w®æ¦¡Åã¥Ü
(85) Userform1.Show ¡yÅã¥Ü¥Î¤áµ¡Åé
(86) Load Userform1 ¡y¥[¸ü¤@­Ó¥Î¤áµ¡Åé,¦ý¸Óµ¡Åé³B©óÁôÂꬺA
(87) Userform1.Hide ¡yÁôÂåΤᵡÅé
(88) Unload Userform1 ©Î Unload Me ¡y¨ø¸ü¥Î¤áµ¡Åé
(89) (¹Ï¹³±±¥ó).Picture=LoadPicture(¡u¹Ï¹³¸ô®|¡v) ¡y¦b¥Î¤áµ¡Å餤Åã¥Ü¹Ï§Î
(90) UserForm1.Show 0 ©Î UserForm1.Show vbModeless ¡y±Nµ¡Åé³]¸m¬°µL¼Ò¦¡ª¬ºA
(91) Me.Height=Int(0.88*ActiveWindow.Height) ¡yµ¡Åé°ª«×¬°·í«e¬¡°Êµ¡¤f°ª«×ªº0.88
Me.Width=Int(0.88*ActiveWindow.Width) ¡yµ¡Åé¼e«×¬°·í«e¬¡°Êµ¡¤f°ª«×ªº0.88

¨Æ¥ó
(92) Application.EnableEvents=False '¸T¥Î©Ò¦³¨Æ¥ó
Application.EnableEvents=True '±Ò¥Î©Ò¦³¨Æ¥ó
µù¡G¤£¾A¥Î©ó¥Î¤áµ¡Åé±±¥óIJµoªº¨Æ¥ó

¹ï¶H
(93) Set ExcelSheet = CreateObject("Excel.Sheet") ¡y³Ð«Ø¤@­ÓExcel¤u§@ªí¹ï¶H
ExcelSheet.Application.Visible = True '³]¸m Application ¹ï¶H¨Ï Excel ¥i¨£
ExcelSheet.Application.Cells(1, 1).Value = "Data" '¦bªí®æªº²Ä¤@­Ó³æ¤¸¤¤¿é¤J¤å¥»
ExcelSheet.SaveAs "C:\TEST.XLS" '±N¸Óªí®æ«O¦s¨ìC:\test.xls ¥Ø¿ý
ExcelSheet.Application.Quit 'Ãö³¬ Excel
Set ExcelSheet = Nothing 'ÄÀ©ñ¸Ó¹ï¶HÅܶq
(94) ¡yÁn©ú¨Ã³Ð«Ø¤@­ÓExcel¹ï¶H¤Þ¥Î
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.WorkSheet
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
(95) ¡y³Ð«Ø¨Ã¶Ç»¼¤@­Ó Excel.Application ¹ï¶Hªº¤Þ¥Î
Call MySub (CreateObject("Excel.Application"))
(96) Set d = CreateObject(Scripting.Dictionary) ¡y³Ð«Ø¤@­Ó Dictionary ¹ï¶HÅܶq
(97) d.Add "a", "Athens" '¬°¹ï¶HÅܶq²K¥[ÃöÁä¦r©M±ø¥Ø

¨ä¥L
(98) Application.OnKey ¡u^I¡v,¡vmacro¡v '³]¸mCtrl+IÁ䬰macro¹Lµ{ªº§Ö±¶Áä
(99) Application.CutCopyMode=False ¡y°h¥X°Å¤Á/½Æ»s¼Ò¦¡
(100) Application.Volatile True 'µL½×¦ó®É¤u§@ªí¤¤¥ô·N³æ¤¸®æ­«·s­pºâ¡A³£·|±j¨î­pºâ¸Ó¨ç¼Æ
Application.Volatile False '¥u¦³¦b¸Ó¨ç¼Æªº¤@­Ó©Î¦h­Ó°Ñ¼Æµo¥Í§ïÅܮɡA¤~·|­«·s­pºâ¸Ó¨ç¼Æ

­Y¦³»~¡A·Ð½Ð§iª¾¡A·s¤âµo©«½Ð¦h¥]²[ :)

§Ú«Y¤@­Ó·s¤â¡AÀò¯q¨}¦h¡I·PÁ¤À¨É¡I

TOP

        ÀR«ä¦Û¦b : ¡i¬°µ½Ävª§¡j¤H¥Í­n¬°µ½Ävª§¡A¤À¬í¥²ª§¡C
ªð¦^¦Cªí ¤W¤@¥DÃD