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

[µo°Ý] WORDÀɸê®Æ¦ì²¾µLªk¤À¶}Ū¨ú

[µo°Ý] WORDÀɸê®Æ¦ì²¾µLªk¤À¶}Ū¨ú

¦U¦ì¤j¤j¦n¡G

   ¤p§Ì·Q§Q¥Î¤U¦C»yªk¨ú¥X«ü©wWORDÀÉ
¨äÀɮ׮榡¬°RTF¡C¦ýµo²{¸ÓÀɮ׸ê®Æ¨ú
¥X¤§«á¨ä¦ì¸m¤w¦ì²¾¡A¦]¦¹µLªk¹³TXTÀÉ
¥i­pºâ²Ä´X¦ì¤¸¼Æ¡C
   ¤p§Ì¶}±ÒWORD¤]µo²{¥¦¦³¨Ï¥Î¨ì©w¦ìÂI
¡A±q¨ä¼ÐÃD¦³¤­­Ó³¡¤À¤]¤À§O¨Ï¥Î©w¦ìÂI¡C
¦ý¥u­nŪ¨ú¸Ó¸ê®Æ®É¡A¤S·|¥X²{¾ã¦C¸ê®Æ
¨Ö¦b¤@°_¡CµLªk¹³¥¦¨Ï¥Îªº©w¦ìÂI¥i¤À¶}Ū¨ú¡C
½Ð°Ý¦p¦ó¥iºâ¥X¦ì¤¸¼Æ¨Ã¨ú¥X¸ÓÀÉ®×
¸ê®ÆÂà¤J¦ÜEXCELªí¤º©O¡H

»yªk¦p¤U¡G
Sub test()
   
    Dim wrdApp As Word.Application
    Dim wrdDoc As Word.Document
    Dim tString As String, tRange As Word.Range
    Dim p As Long
    Dim mFile$
   
    Application.ScreenUpdating = False
   
    mFile = "D:\temp\r75test.rtf"
   
    Set wrdApp = CreateObject("Word.Application")
    Set wrdDoc = wrdApp.Documents.Open(mFile, ReadOnly:=True)
  
    With wrdDoc
        For p = 1 To .Paragraphs.Count
            Set tRange = .Range(Start:=.Paragraphs(p).Range.Start, _
                End:=.Paragraphs(p).Range.End)
            tString = tRange.Text
            Debug.Print tString    'Ū¨ú¤§«á¨ä©w¦ìÂIªº¦ì¸m¤v¤£¦s¦b¤F
           
        Next p
        .Close ' close the document
    End With
    wrdApp.Quit ' close the Word application
    Set wrdDoc = Nothing
    Set wrdApp = Nothing     
   
End Sub
ÁÂÁ¦U¦ì¤j¤j
R75TEST.rar (3.69 KB)

¦^´_ 1# dechiuan999
§Ú WORD ªºVBA ¤£¤Ó¼ô, ¸Õ¸Õ¬Ý½Æ»s¨ìExcel ¦b¥h³B²z
  1. Sub ¥¨¶°2()
  2.      Application.ActiveDocument.Range.Copy
  3.      Word_vba
  4. End Sub
  5. Sub Word_vba()
  6.     Dim xlWkApp As Object, xlWk As Object
  7.     Set xlWkApp = CreateObject("excel.application")
  8.     Application.DisplayAlerts = False                 'Ãö³¬¨t²Îªº¸ß°Ýµøµ¡
  9.     With xlWkApp
  10.         .Visible = True
  11.         Set xlWk = .workbooks.Open(FileName:="d:\¸Õºâªí\Book3.xls", Password:="1234", IgnoreReadOnlyRecommended:=False)
  12.        ' xlWk.Sheets(1).Range("c3") = ActiveDocument.Tables(1).Cell(1, 1)
  13.         xlWk.Sheets(1).Paste
  14.         xlWk.Close False
  15.     End With
  16.     xlWkApp.Quit
  17.     Set xlWkApp = Nothing
  18. End Sub
½Æ»s¥N½X

TOP

¦^´_ 2# GBKEE
ª©¥D¤j¤j±z¦n¡G

   ÁÂÁª©¥D¤j¤jªº«ü敎¡C
¤£¹L¡A¤p§ÌÁÙ¬OµLªk²z¸Ñ
»yªkªº¤º§t¡C¤£ª¾¦p¦ó±Ò¥Î
¸Ó»yªk¡C
   ¥t¤§«e«È¤áºÝ´£¨Ñªº
WORDÀÉ¡A¤p§Ì·|¥ý±N¨äÂন
TXTÀɦA§Q¥ÎWORKBOOKS.OPENTEXT FILENAME
§Q¥Î¸ê®Æ­åªR¤è¦¡¨ú¥X¸ê®Æ¡C
«á¨Ó§ï¥ÎHSIEHª©¥D¤j¤j´£¨Ñª½±µ¤Þ¥Î
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
¤]³£«Ü¶¶§Q¡C³Ì¥D­nªº¬O¸Ó¸ê®Æªº
±Æ¦C¦ì¸m¥i¥H«Ü²M·¡ªº¤À¿ë¬OÄÝ©ó
¨º¤@Äæ¦ìªº¸ê®Æ¡C
¦ýªñ¤é«È¤áºÝ¤£ª¾¬°¦ó¨äWORDª©¥»¬Ý
¦ü¬Û¦P¡A¦ýÂনTXTÀɮɾã­ÓÄæ¦ì
·|¨Ö¦b¤@°_¡A¤]´NµLªk¤À¿ë¬O¨º¤@Äæ
¦ìªº¸ê®Æ¤F¡C¦]¨äªíÀY¥i¤À¦¨¥|­ÓÄæ¦ì
¤@¡BMarks & Nos  
¤G¡BDescription of Goods
¤T¡BQuantity
¥|¡BUnit Price

¦]¦¹¡A¤p§Ì¥u¦n§ï¥Î¤H¤uÁä½L
¨Ó¿é¤J¸ê®Æ¡A¦A¦s¤J¦Û¤vªº
¸ê®Æ®w¡C¤£¦ý®ö¶O®É¶¡¡A¤S
·|担¼~¸ê®Æ¥X¿ù¡C

¤p§Ì·Q¦A´£¨Ñ¤§«e«È¤áºÝ´£¨Ñ
ªº¥t¤@WORDÀɮסA¨Ï¥Î¤p§Ì
ªºªí³æ¨Ó¨ú¥X¸ê®Æ¤]³£¥i¥H
逹¦¨¡C¤£ª¾¦¹¤G­ÓÀɮ׬°¦ó
·|¦³¦p¦¹¤jªº®t²§©O¡H

ÁÂÁª©¥D¤j¤j¡C
AA.rar (35.23 KB)

Testword.rar (30.28 KB)

TOP

¦^´_ 2# GBKEE


ª©¥D¤j¤j¦­¦w¡G
¤p§Ì¤µ¦­¦³´ú¸Õ¤@­ì©l¤èªk¡A
¥ý¶}±ÒExcel¡÷¦A¶}±Ò¸Ó
WordÀɤ§«á¡A±N±ý½Æ»s
¤§Word¸ê®Æ¿ï¨ú¡÷¿ï½Æ»s
¡÷¦A¦^¨ìExcel¿ï¶K¤W¡C¨ä
ªí®æ¤´«O¯d»Pword¬Û¦P¡C
¦]¦¹¡A¤p§Ì¥i¥ý¨Ï¥Î¥b¤â¤u
¤è¦¡¨Ó¹F¤F¡C
¥u¬O¤p§Ì¤´·Qª¾¹D¦p¦ó¬ð¯}¦¹
wordÀɬ°¦ó³z¹Lµ{¦¡Åª¨ú®É
¨äªí®æÄæ¦ì·|§¹¥þ§ïÅÜ©O¡H

·P®¦¤j¤j¡I

TOP

¦^´_ 4# dechiuan999
¨â¤å¥óªº®æ¦¡¤£¬Û¦P¬O«Ü¶Ë¸£ªº §ÚºCºC¸Õ¸Õ¬Ý¬O§_¦³¸Ñ,
¥B¦³Áٽаª¤â¬Ý¬Ý

TOP

¦^´_ 4# dechiuan999
WORDÀÉ¡A¤p§Ì·|¥ý±N¨äÂন,TXTÀɦA§Q¥ÎWORKBOOKS.OPENTEXT FILENAME,§Q¥Î¸ê®Æ­åªR¤è¦¡¨ú¥X¸ê®Æ¡C
§ï¥Î OpenTextFile  ¶}±Ò TXTÀÉ ¸Õ¸Õ¬Ý

WORDÀɸê®Æ¦ì²¾.rar (22.19 KB)
  1. Private Sub UserForm_Initialize()
  2.     xPath = "D:\"          '  ³o¸Ì½Ð­×§ï¬°«ü©wªº¥Ø¿ý
  3.     Set mSh = ThisWorkbook.Sheets("IV")
  4.     mSh.Cells.Clear
  5.     CommandButton2.Enabled = False
  6.     CommandButton3.Enabled = False
  7.     CommandButton4.Enabled = False
  8. End Sub
½Æ»s¥N½X

TOP

¦^´_ 6# GBKEE


    ª©¥D¤j¤j±z¦n¡G

¤p§Ì¤Þ¥Îª©¥D¤j¤j´£¨Ñ¤§
»yªk´ú¸Õ«Ü¦¨¥\¡C
¤p§Ì·|¦A¸Ô¥[¬ã¨sª©¥D¤j¤j
ªº»yªk¡C
¥Ø«e¤´³B¦b霚¸Ì¬Ýªá
ªº¶¥¬q¡C

·P®¦¤j¤j¡I

TOP

¥»©«³Ì«á¥Ñ dechiuan999 ©ó 2012-6-26 07:05 ½s¿è

¦^´_ 6# GBKEE


ª©¥D¤j¤j±z¦n¡G

  ¤p§Ì¤w²z¸Ñª©¥D´£¨Ñ
ªº»yªk¤F¡C·í§Ú²z¸Ñ»yªkªº
®É­Ô¡A·P¨ü¨ººØ³ß®®¯u¬O
¥t¤HÃø¥H§Î®e ¡C
TheSplit = Split(Str, vbTab)
¦hÁª©¥D¤j¤j¦p¦¹¶O¤ß¬Û§U¡C
¤p§Ì¯u¬O¨ü¯q¨}¦h¡C

´N·P®¦¡I

TOP

¦^´_ 8# dechiuan999
·í§Ú¥i¥HÀ°§A¸ÑÃD®É, §A·P¨ü¨ººØ³ß®®ªº·Pı,§Ú¤]¬O·P¦P¨­¨üªº

TOP

        ÀR«ä¦Û¦b : «Ý¤H°h¤@¨B¡A·R¤H¼e¤@¤o¡A´N·|¬¡±o«Ü§Ö¼Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD