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

[µo°Ý] EXCEL 2007 VBA ¦bEXCEL 2010 °õ¦æ¥X°ÝÃD

¦^´_ 2# li_hsien
  1. Sub w_report_Click()
  2.     '-----¶}±ÒWªí³æ-----   
  3.     Dim program_file As String, filename As String, w_file As String   
  4.     program_file = Left(ActiveWorkbook.Name, Application.Find(".", ActiveWorkbook.Name) - 1)
  5.     filename = Application.GetOpenFilename   
  6.     On Error GoTo HandleErr  '§A§Æ±æµ{¦¡½X¦³¿ù»~¨ì HandleErr
  7.      A w_file '¦ý°õ¦æ¦¹µ{§Ç,¦p¦³¿ù»~·|¦^¨ìHandleErr,§A¤£©ö°»¿ùªº
½Æ»s¥N½X
  1. Sub A(w_file)
  2.     Dim this_week As Integer, end_col As Integer, end_row As Integer, i As Integer, delete_col As Integer
  3.    'w_file->W1414_GF108_CP_weekly_report
  4.    'w_file ¥¿½T¬° W1414_GF108_CP_weekly_report.xls
  5.     With Workbooks(w_file).Worksheets(1)  'Workbooks(w_file)¤~¤£·|¥X¿ù
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 4# li_hsien
§Úªº¬O2003ª©,°õ¦æªþÀɵ{¦¡½X¬O2003ª©¥H¤Wª©¥»¼gªº.
¿ù»~ÂI³£¬O "¤£¤ä´©¦¹ÄݩʩΤèªk" ,¥i¥H¼Ð¥X¿ù»~ÂI¬O­þ¸Ì,¬Ý¬Ý¦p¦ó¸Ñ¨M
  1. Sub A_chart(w_file)
  2.     'Dim C As ChartObject
  3.     'Set C = Workbooks(w_file).Worksheets(1).ChartObjects("Chart 3")
  4.     With Workbooks(w_file).Worksheets(1).ChartObjects("Chart 3").Chart
  5.         '.ChartArea.Format.Line.Visible = msoFalse   '2003¿ù»~
  6.         .ChartArea.Border.LineStyle = msoFalse   '§ï¦¨³o¼Ë¹ï¶Ü?
  7.         .SizeWithWindow = True
  8.         '.ChartArea.Width = 362.5 '¼e«× ­ì1449.25      '2003¿ù»~
  9.         '.ChartArea.Height = 124.75  '°ª«× ­ì178.75    '2003¿ù»~
  10.         .Parent.Width = 362.5  ' *** ³o¼Ë¹ï¶Ü? ***
  11.         .Parent.Height = 124.75
  12.         
  13.         With .PlotArea
  14.             .Height = 102.148661417323 'ø¹Ï°Ï°ª«× ­ì120.97031496063
  15.             .Width = 342.872283464567  'ø¹Ï°Ï¼e«× ­ì358.980866141732
  16.             .Left = 10 'ø¹Ï°Ï¦ì²¾
  17.             .Top = 10  'ø¹Ï°Ï¦ì²¾
  18.         End With

  19.         '¹Ïªí¼ÐÃD
  20.         With .ChartTitle
  21.             If IsError(Application.Find(".", Worksheets(2).Range("G2"))) = False Then
  22.                 .Text = Left(ActiveChart.ChartTitle.Text, Application.Find(" ", ActiveChart.ChartTitle.Text) - 1) _
  23.                     & "-" & Mid(Worksheets(2).Range("G2"), Application.Find(".", Worksheets(2).Range("G2"), Application.Find(".", Worksheets(2).Range("G2")) + 1) + 1, 3) _
  24.                     & " " & "wk" & Right(Worksheets(2).Range("A2"), 4) & " " & Right(ActiveChart.ChartTitle.Text, 15)
  25.             ElseIf IsError(Application.Find(".", Worksheets(2).Range("G2"))) = True Then
  26.                 .Text = Left(ActiveChart.ChartTitle.Text, Application.Find(" ", ActiveChart.ChartTitle.Text) - 1) _
  27.                     & "-" & Mid(Worksheets(2).Range("G2"), Application.Find("_", Worksheets(2).Range("G2"), Application.Find("_", Worksheets(2).Range("G2")) + 1) + 1, 3) _
  28.                     & " " & "wk" & Right(Worksheets(2).Range("A2"), 4) & " " & Right(ActiveChart.ChartTitle.Text, 15)
  29.             End If
  30.             .Font.Size = 6.5  '¼ÐÃD¦rÅé¤j¤p
  31.             .Font.Name = "Arial" '¼ÐÃD¦r«¬
  32.             .Left = 123  '¼ÐÃD¦ì²¾
  33.         End With
  34.         With .Legend
  35.             .Position = xlLegendPositionBottom  '¹Ï¨Ò¦C©³³¡
  36.             '.Legend.Top = 300   '¹Ï¨Ò¦ì²¾
  37.             .Top = Range("A21").Top
  38.             .Font.Size = 6.5 '¹Ï¨Ò¦rÅé¤j¤p
  39.             .Font.Name = "Arial" '¹Ï¨Ò¦r«¬
  40.         End With
  41.         With .SeriesCollection("Yield")
  42. '            .SeriesCollection(4).Border.ColorIndex = 18 '½u±øÃC¦â
  43.             .Border.Color = 5066944 '½u±øÃC¦â
  44.             '.SeriesCollection("Yield").Format.Line.Weight = 1 '½u±ø&¼Ð°O¼e¬°1
  45.             '.Format.Line 2003¿ù»~ ***********
  46.             .Border.Weight = 1            '.LineStyle = 0
  47.             .Border.Weight = -4138   '¥u§ïÅܽu±ø
  48.             .MarkerStyle = 2  '¼Ð°OµÙ§Î
  49.             .MarkerBackgroundColorIndex = 2 '¼Ð°OÃC¦â(¥Õ)
  50.             .MarkerSize = 5    '¼Ð°O¤j¤p5
  51.             .MarkerForegroundColor = 5066944    '¼Ð°O¥~®Ø
  52.             .ApplyDataLabels  'Åã¥Ü¸ê®Æ¼ÐÅÒ
  53.             .DataLabels.Font.Size = 5  '¤W¦C¼Æ­È¦rÅé¤j¤p
  54.             .DataLabels.Font.Name = "Arial" '¤W¦C¼Æ­È¦r«¬
  55.             
  56.         End With
  57.         '.SeriesCollection("Yield").Select    '¤£»Ý­n
  58.        ' .SetElement (msoElementDataLabelTop) '¸ê®Æ¼ÐÅÒ¸m¤W '2003¨S³o¿ï¶µ
  59.         .Axes(xlValue, xlPrimary).AxisTitle.Font.Size = 6.5 'Y¶b¼ÐÃD¤j¤p
  60.         .Axes(xlValue, xlPrimary).AxisTitle.Font.Name = "Arial" 'Y¶b¼ÐÃD¦r«¬
  61.         .Axes(xlValue, xlPrimary).AxisTitle.Left = -3  'Y¶b¼ÐÃD¦ì²¾

  62.         .Axes(xlCategory).TickLabels.Font.Size = 5  'X¶b¦rÅé¤j¤p
  63.         .Axes(xlCategory).TickLabels.Font.Name = "Arial"    'X¶b¦r«¬
  64.         
  65.         .Axes(xlValue).TickLabels.Font.Size = 6.5  'Y¶b¦rÅé¤j¤p
  66.         .Axes(xlValue).TickLabels.Font.Name = "Arial"  'Y¶b¦r«¬
  67.         
  68.         .SeriesCollection("Yield").DataLabels.Font.Size = 5  '¤W¦C¼Æ­È¦rÅé¤j¤p
  69.         .SeriesCollection("Yield").DataLabels.Font.Name = "Arial" '¤W¦C¼Æ­È¦r«¬
  70.     End With
  71. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-4-25 13:25 ½s¿è

¦^´_ 6# li_hsien
¦Û¤v¹q¸£´ú¸Õ¦³°ÆÀɦW ¨S°ÆÀɦW³£¥i¥H (¤]¬O2003ª©¶Ü?,¥i¥H¶Ü?)
  1. 'Workbooks(program_file).Worksheets(1).w_file = ""  '2003³o¸Ì¬O¿ù»~ªº
  2.       w_file = ""  
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-4-25 14:51 ½s¿è

¦^´_ 8# li_hsien
¨º¤£¦n·N«ä§Ú¥u¦³2003ª©À°¤£¤W¦£¤F.»Ý¦³½Ð2010ª©ªºÀ°¦£.
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 11# li_hsien
  1. MsgBox filename   '¦³°ÆÀɦWªº
  2. 'Dir ¨ç¼Æ »yªk Dir [(pathname[, attributes])]
  3. w_file = Dir(filename, vbNormal)  '¥[ attributes³o°Ñ¼Æ¸Õ¸Õ¬Ý
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : µoµÊ®ð¬Oµu¼ÈªºµoºÆ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD