![]() |
|
#1
|
||||
|
||||
|
I am opening HTML files using following code.
Code:
Sub tester()
Dim oFSO As Object
Dim oFS As Object, sText As String, StrTxtT As String, StrTxtD As String, StrTxtN As String, URL As String, Rng As Range
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFS = oFSO.OpenTextFile("C:\Users\Username\Desktop\ProStrakan, Inc. et al v. Actavis Laboratories UT, Inc. et al.html")
Dim strSource As String
Dim strDest As String
Do Until oFS.AtEndOfStream
sText = oFS.ReadAll()
do some split and replace to finally get StrTxt
|
|
#2
|
||||
|
||||
|
Try something based on:
Code:
Sub UpdateFiles()
Application.ScreenUpdating = False
Dim strFolder As String, strFile As String, strDocNm As String, wdDoc As Document
strDocNm = ActiveDocument.FullName
strFolder = GetFolder
If strFolder = "" Then Exit Sub
strFile = Dir(strFolder & "\*.htm", vbNormal)
While strFile <> ""
If strFolder & "\" & strFile <> strDocNm Then
Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
With wdDoc
'Process the document here
.Close SaveChanges:=True
End With
End If
strFile = Dir()
Wend
Set wdDoc = Nothing
Application.ScreenUpdating = True
End Sub
Function GetFolder() As String
Dim oFolder As Object
GetFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
||||
|
||||
|
Solved the problem.
|
|
| Tags |
| vba |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Compare files in different directories, slightly different namesm, Macro doesn't loop | lkpederson | Word VBA | 0 | 04-28-2015 01:32 PM |
Loop through files and Copy Table Row and Paste into Different Document
|
spiderman1369 | Word VBA | 2 | 10-15-2014 08:30 AM |
Unlink source files when creating Church Directory with INCLUDEPICTURE
|
JohnFinNC | Mail Merge | 3 | 09-18-2014 08:50 PM |
| Copy Files to a directory | elmnas | Word VBA | 8 | 07-11-2014 12:07 AM |
Importing Archived .pst files does not work
|
JoJo | Outlook | 2 | 01-27-2011 12:33 PM |