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

excel¶}±Òword¶ñ¤J¬ÛÃö¸ê®Æ

excel¶}±Òword¶ñ¤J¬ÛÃö¸ê®Æ

½Ð¦U¦ì¥ý¶iÀ°¦£¥Îvba¥Îexcel¶}±Òword¶ñ¤J¬ÛÃö¸ê®Æ¥i¥H°µ¨ì¶Ü
?½Ð°Ñ¦Òexcelªþ¥ó»¡©úÁÂÁ¡C

1.zip (8.69 KB)

¦^´_ 1# y663258
§Aªº¨Ò¤l´N§Ú©Òª¾,
¤@¯ë³£¬O¥Î Word ªº¦X¨Ö¦C¦L¥\¯à¨Ó¹F¦¨ªº³á,

¨Ï¥Î¸Ó¥\¯àª½±µ´N¥i¥H²£¥Í®M¥Î¤F¨C¤@­Ó¤H¸ê®Æªº "¦¨ªG³ø§i" µe­±,
¦sÀÉ«á­Y­n¦C¦L­Ó§O¤Hªº¸ê®Æ®É¥u­n«ü©w¦L­þ¤@­¶´N¦n.
¦¨ªG³ø §i(¦X¨Ö¦C¦L«á).zip (5.08 KB)

TOP

¦^´_ 2# luhpro


    ÁÂÁÂiuhprohu¥ý¶i«ü¾É,³o¤@­Ó¦n¤èªk,¥u¬O¦W³æ¦³´X¦Êµ§¡A§Ú­nªº¥u¬O§ä¥X¤@µ§¦b"¦¨ªG³ø§i.doc"²Ä¤@­¶¶ñ¤J¬ÛÃö°ò¥»¸ê®Æ¡AÄò­¶»Ý¬OªÅ¥Õ­¶­n¼¶¼g¬ÛÃö³ø§i¡C
       iuhprohu¥ý¶i¥i§_¦pªþ¥ó»Ý¨Dµ¹¤©¨ó§UÁÂÁ±z¡C

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-10-10 05:34 ½s¿è

¦^´_ 3# y663258

   
§Ú­nªº¥u¬O§ä¥X¤@µ§¦b"¦¨ªG³ø§i.doc"²Ä¤@­¶¶ñ¤J¬ÛÃö°ò¥»¸ê®Æ

¸Õ¸Õ¬Ý
§A 1# ªþÀÉ ªí³æªºµ{¦¡½X  ´M§ä:¨­¥÷ÃÒ¦r¸¹
  1. Dim Rng As Range
  2. Private Sub TextBox1_Change()
  3.     If Trim(TextBox1) <> "" Then  '¥h°£¨â®ÇªÅ¥Õ¦r¤¸«áªºTextBox1
  4.         Set Rng = Sheets("SHEET1").Range("a:a").Find(Trim(TextBox1), LOOKAT:=xlWhole)
  5.                                 ' .Range("a:a") ´M§ä:¨­¥÷ÃÒ¦r¸¹
  6.         If Not Rng Is Nothing Then
  7.             If MsgBox(TextBox1 & vbLf & "¦L¦C?", vbYesNo, "¦¨ªG³ø §i") = vbYes Then Ex
  8.         End If
  9.     End If
  10. End Sub

  11. Private Sub Ex()
  12.     Dim AR, i As Integer
  13.     AR = Array("¦¨ªG³ø §i", "H", "B", "D", "A", "I", "J", "K")
  14.        'ªíÀY¦UÄæ¦ì¶µ¥Ø¦r¦ê¶¡¹j½Ð¦Û¦æ½Õ¾ã»PÅã¥Ü¦b "¦¨ªG³ø §i.DOC,ªº¦r¦ê¶¡¹j¤@­P
  15.     For i = 1 To UBound(AR)
  16.         AR(i) = Cells(1, AR(i)) & " : " & Rng.Cells(1, AR(i))
  17.         '¾É¤J ¨CÄæ¦ìªºªíÀY&":"&¦r¦ê(¤º®e)
  18.     Next
  19.     With CreateObject("WORD.APPLICATION")
  20.         .Visible = True
  21.         .Documents.Open "d:\¦¨ªG³ø §i.doc"
  22.         With .ActiveDocument
  23.             .Range(.Range.Start, .Range.End).Text = Join(AR, vbLf)
  24.             With .Range
  25.                 .Font.Size = 16
  26.                 .ParagraphFormat.Alignment = 0    'wdAlignParagraphLeft     '¾a¥ª
  27.                 With .Paragraphs(1).Range
  28.                     .Font.Size = 24
  29.                     .ParagraphFormat.Alignment = 1 ' wdAlignParagraphCenter '¦Ü¤¤
  30.                 End With
  31.             End With
  32.             .PrintOut    '¦L¦C
  33.             .Close
  34.         End With
  35.         .Quit
  36.    End With
  37. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 4# GBKEE


    ·PÁÂGBKEEª©¥D¤j¤O¨ó§U±zªºµ{¦¡¥i¥H¦p¤p²Ä©Ò»Ý¹B§@¡A¤µ·Q½Ðª©¥D¦A¦¸¨ó§U§ó§ï¶}±ÒDocuments.Open "d:\¦¨ªG³ø §i.doc"­ì¥»¥u¦³¤@­¶­Y§ï¦¨¤G­¶¡A  ¥Ø«eµ{¦¡¥u¯àÅã¥Ü²Ä¤@­¶(§@¥Î­¶)¦]¦Û¤v¤~²¨¾Ç²L¡A§ä´M¬ÛÃö¸ê®Æ¸Õ¤F«Ü¤[ÁÙ¬O¥¢±Ñ¡A½Ðª©¥D¦Aµ¹¤©¨ó§UÁÂÁ¡C
Dim Rng As Range
Private Sub TextBox1_Change()
    If Trim(TextBox1) <> "" Then  '¥h°£¨â®ÇªÅ¥Õ¦r¤¸«áªºTextBox1
        Set Rng = Sheets("SHEET1").Range("a:a").Find(Trim(TextBox1), LOOKAT:=xlWhole)
                                ' .Range("a:a") ´M§ä:¨­¥÷ÃÒ¦r¸¹
        If Not Rng Is Nothing Then
            If MsgBox(TextBox1 & vbLf & "¦L¦C?", vbYesNo, "¦¨ªG³ø §i") = vbYes Then Ex
        End If
    End If
End Sub

Private Sub Ex()
    Dim AR, i As Integer
    AR = Array("¦¨ªG³ø §i", "H", "B", "D", "A", "I", "J", "K")
       'ªíÀY¦UÄæ¦ì¶µ¥Ø¦r¦ê¶¡¹j½Ð¦Û¦æ½Õ¾ã»PÅã¥Ü¦b "¦¨ªG³ø §i.DOC,ªº¦r¦ê¶¡¹j¤@­P
    For i = 1 To UBound(AR)
        AR(i) = Cells(1, AR(i)) & " : " & Rng.Cells(1, AR(i))
        '¾É¤J ¨CÄæ¦ìªºªíÀY&":"&¦r¦ê(¤º®e)
    Next
    With CreateObject("WORD.APPLICATION")
        .Visible = True
        .Documents.Open "d:\¦¨ªG³ø §i.doc"­ìÀÉ®×¥u¦³¤@­¶²{§ï¦³¤G­¶¡A­n³o¤G­¶¯àÀx¦s¦b"d:\¦¨ªG³ø §i.doc"
        With .ActiveDocument
            .Range(.Range.Start, .Range.End).Text = Join(AR, vbLf)
            With .Range
                .Font.Size = 16
                .ParagraphFormat.Alignment = 0    'wdAlignParagraphLeft     '¾a¥ª
                With .Paragraphs(1).Range
                    .Font.Size = 24
                    .ParagraphFormat.Alignment = 1 ' wdAlignParagraphCenter '¦Ü¤¤
                End With
            End With
            .PrintOut    '¦L¦C
            .Close
        End With
        .Quit
   End With
End Sub

TOP

¦^´_ 5# y663258
  "d:\¦¨ªG³ø §i.doc"­ì¥»¥u¦³¤@­¶­Y§ï¦¨¤G­¶¡A  ¥Ø«eµ{¦¡¥u¯àÅã¥Ü²Ä¤@­¶(§@¥Î­¶)¦]¦Û¤v¤~²¨¾Ç²L¡A§ä´M¬ÛÃö¸ê®Æ¸Õ¤F«Ü¤[ÁÙ¬O¥¢±Ñ

¦³¤@­¶­Y§ï¦¨¤G­¶,¤£¤F¸Ñ§Aªº·N«ä,¬O­×§ï«áªº¦sÀɶÜ??
  1. End With
  2. .PrintOut '¦L¦C
  3. .Close True '¦sÀɰѼÆ=True ,¤£¦sÀɰѼÆ=False(¹w³]ªº°Ñ¼Æ)
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 6# GBKEE


.Documents.Open "d:\¦¨ªG³ø §i.doc"­ìÀÉ®×¥u¦³¤@­¶²{§ï¦¨¦³¤G­¶¡A­n³o¤G­¶¯àÀx¦s¦b"d:\¦¨ªG³ø §i.doc"
        With .ActiveDocument
    ¶} ±Òd:\¦¨ªG³ø §i.doc­Y§ï¦¨¦³¤G­¶,¸g With .ActiveDocument«á¥u³Ñ²Ä¤@­¶,¥i¥H±N¤G­¶³£«O¦s¶Ü?¥i¯à¬O²Ä¤G­¶¨S¦³§@¥Îªº­ì¬G©Ò¥H¤£¨£¤F¡C

TOP

¦^´_ 7# y663258

¸Õ¸Õ¬Ý
  1. Private Sub Ex()
  2.     Dim AR, i As Integer
  3.     AR = Array("¦¨ªG³ø §i", "H", "B", "D", "A", "I", "J", "K")
  4.        'ªíÀY¦UÄæ¦ì¶µ¥Ø¦r¦ê¶¡¹j½Ð¦Û¦æ½Õ¾ã»PÅã¥Ü¦b "¦¨ªG³ø §i.DOC,ªº¦r¦ê¶¡¹j¤@­P   
  5.     For i = 1 To UBound(AR)
  6.         AR(i) = Cells(1, AR(i)) & " : " & Rng.Cells(1, AR(i))
  7.         '¾É¤J ¨CÄæ¦ìªºªíÀY&":"&¦r¦ê(¤º®e)
  8.     Next
  9.     With CreateObject("WORD.APPLICATION")
  10.         .Visible = True
  11.         .Documents.Open "d:\¦¨ªG³ø §i.doc"
  12.         With .ActiveDocument
  13.             For i = 0 To UBound(AR)
  14.                 If i + 1 > .Paragraphs.Count Then .Paragraphs.Add
  15.                 With .Paragraphs(i + 1).Range
  16.                     .Text = AR(i) & vbLf
  17.                     .Font.Size = IIf(i = 0, 24, 16)
  18.                     .ParagraphFormat.Alignment = IIf(i = 0, 1, 0)
  19.                 End With               
  20.             Next
  21.             .PrintOut    '¦L¦C
  22.         .Close True  '¦sÀÉ
  23.         End With
  24.         .Quit
  25.    End With
  26. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

ÁÂÁÂGBKEEª©¥D¤j¤O¨ó§U¡A¸g±z¦A¦¸­×§ïµ{¦¡¤v²Å¦X¤p²Ä»Ý¨D¡C

TOP

        ÀR«ä¦Û¦b : ¤@­Ó¤Hªº§Ö¼Ö¡D¤£¬O¦]¬°¥L¾Ö¦³±o¦h¡A¦Ó¬O¦]¬°¥L­p¸û±o¤Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD