-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloadRTF.cls
44 lines (32 loc) · 937 Bytes
/
loadRTF.cls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
'******************************************
'Last update 22.08.2018
'Por [email protected]
'******************************************
Option Explicit
Option Private Module
Private Sub loadRTF()
Dim wdApp As Word.Application
Dim wdDoc As Word.Document
Dim rngDestination As Excel.Range
Dim sPath As String
Dim sFile As String
sPath = "YOUR .RTF FILE PATH HERE"
sFile = Dir(sFile & "*.RTF")
Set wdApp = CreateObject("Word.Application")
With wdApp
.Visible = True
.ScreenUpdating = False
.DisplayAlerts = wdAlertsNone
End With
Set wdDoc = wdApp.Documents.Open(Filename:=sPath & sFile)
wdDoc.Content.Copy
Set rngDestination = Application.Range("YOUR DEFINED RANGE")
With rngDestination
.PasteSpecial Paste:=xlPasteValues
End With
ActiveWorkbook.Sheets("YOUR DEFINED SHEET").Activate
wdDoc.Close (True)
Set wdDoc = Nothing
wdApp.Quit (True)
Set wdApp = Nothing
End Sub