I have 1800 html files wich i extracted from a website with HTTrack. In this files are some infos that i need to put in a xls file.
A friend of mine tried to help me but ( he knows programming and stuff ) but told me it is to difficult.
So i start google-ing and this is what i came up with. - I used a software for converting html files to xls.
- Searched this forum for a vb script and actualy worked very well. i have all the infos but one. In the html file there is a link that i must put allso in xls.
Once i converted html to xls the linked dissapeared so i am stuck now.
Searched a lot on google for other ways to do this but there had no luck.
7 1693
If you load the page via a webbrowser control you could use a for each loop to enumerate through the link in the page... -
Dim Link As Object, Links As Object
-
-
WB.Navigate "file://c:\z\a\forums.html"
-
Do While WB.ReadyState <> READYSTATE_COMPLETE
-
DoEvents
-
Loop
-
Set Links = WB.Document.getelementsbytagname("a")
-
For Each Link In Links
-
Debug.Print Link.href
-
Next
-
Good Luck
I mangaed with help to put on every excell file the link. Eevery link is at A1 cell of every file like this : Mylink ( and it is hyperlinked with the link )
I have the script bellow, I just need to complet it with that A1 in my final xls. Can you help me guys ? i am a newbie
Thanks - Sub test()
-
Dim wb As Workbook
-
Dim sht As Worksheet
-
Dim r As Integer
-
Set sht = ActiveSheet 'sheet for results
-
r = 2 '1st row
-
myDir = "C:\Documents and Settings\Adelina.ADELINA-467578F\Desktop\New Folder\"
-
myfile = Dir(myDir & "*.xls")
-
Do While Len(myfile) > 0
-
Set wb = Workbooks.Open(myDir & myfile)
-
fnd = False
-
For Each ws In wb.Sheets
-
If ws.Name = "Sheet1" Then fnd = True: Exit For
-
Next
-
If fnd Then
-
With wb.Sheets("Sheet1")
-
sht.Cells(r, 1) = wb.Name
-
sht.Cells(r, 2) = .Range("c76")
-
sht.Cells(r, 3) = .Range("c77")
-
sht.Cells(r, 4) = .Range("c78")
-
sht.Cells(r, 5) = .Range("e78")
-
sht.Cells(r, 6) = .Range("d78")
-
sht.Cells(r, 7) = .Range("f78")
-
sht.Cells(r, 8) = .Range("g77")
-
sht.Cells(r, 9) = .Range("h77")
-
sht.Cells(r, 10) = .Range("i77")
-
sht.Cells(r, 11) = .Range("j77")
-
sht.Cells(r, 12) = .Range("k77")
-
sht.Cells(r, 13) = .Range("l77")
-
-
End With
-
Else
-
MsgBox "no cover note in " & wb.Name
-
End If
-
wb.Close
-
myfile = Dir
-
r = r + 1
-
Loop
-
End Sub
Hi,
At the end, just write :
sht.Cells(r, 14) = .Range("A1")
if so, i am getting the text from a1 and not the url behind the text :)
Hi,
Try this :
sht.Cells(r, 14) = Range("A1").Hyperlinks(1).Address
Regards
Veena
Hello. It finaly worked with your help. But now i have another problem. I have other xls files but every each file has no sheet1 but the name of the xls file.
can anyone help me rebuiding the script bellow ?
thanks
Eg of sheetname: dealers0a26
Sub test()
Dim wb As Workbook
Dim sht As Worksheet
Dim r As Integer
Set sht = ActiveSheet 'sheet for results
r = 2 '1st row
myDir = "C:\Documents and
Settings\Adelina.ADELINA-467578F\Desktop\xlsurile\"
myfile = Dir(myDir & "*.xls")
Do While Len(myfile) > 0
Set wb = Workbooks.Open(myDir & myfile)
fnd = False
For Each ws In wb.Sheets
If ws.Name = "Sheet1" Then fnd = True: Exit For
Next
If fnd Then
With wb.Sheets("Sheet1")
sht.Cells(r, 1) = wb.Name
sht.Cells(r, 2) = .Range("c76")
sht.Cells(r, 3) = .Range("c77")
sht.Cells(r, 4) = .Range("c78")
sht.Cells(r, 5) = .Range("d78")
sht.Cells(r, 6) = .Range("e78")
sht.Cells(r, 7) = .Range("a1")
End With
Else
MsgBox "no cover note in " & wb.Name
End If
wb.Close
myfile = Dir
r = r + 1
Loop
End Sub
Hi,
Just change it to :
Say,.. If my File is "C:\MyFolder\MyExclName.xls"
and if your sheet name is "MyExclName", then : -
Dim NName As String
-
NName = Dir(myFile, vbDirectory)
-
NName = Left(NName, Len(NName) - 4)
-
With wb.Sheets(NName)
-
Regards
Veena
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Els |
last post by:
***newbie question***
Hi, I am trying to make my server (Apache) parse .html files
as .php.
I found this line of code:
ForceType application/x-httpd-php
placed it in an .htaccess file and...
|
by: David Johnson |
last post by:
I am looking for a way to combine the functionality of "include" and
"here documents" so that an included html file containing $variables
is expanded and handled (normally printed to stdout).
It...
|
by: MK |
last post by:
Dear friends,
I have many HTML files and they all have some common HTML code which is
basically bunch of tags which are in all the files. How can I put the common
code in one file and then share...
|
by: ajk |
last post by:
.
Hi, All:
I know how to insert files into a Word doc using C#. However, the program
I've written to do this runs much too slowly. The
"myObj".Application.Selection.InsertFile method executes...
|
by: ddd |
last post by:
I am trying to build a diff tool that allows me to compare two HTML files. I
am looking for resources on how to achive this. The main problem is that I do
not want to simply highlight the line of...
|
by: Paul |
last post by:
Hi still testing the idea of using html files for forms and then integrating
this into a net app. I tried a small form with a button but noticed all I
could do with the button is to right click and...
|
by: nick |
last post by:
I need to create a simple asp.net application that use password protect some
html pages. The html page provider doesn't know asp.net. And the host doesn't
allow me to create user accounts.
...
|
by: nick |
last post by:
I have an Asp.Net 2.0 application using form authentication. I want the html
pages be protected by the authentication system too.
The accessing of html files need to be authenticated in my local...
|
by: Keith |
last post by:
I have an IIS 6.0 web server hosting an ASP.NET 2.0 web site. Help files for
the site are pure html. Is there some way to serve these html pages using
the same ASP.NET web site? If so, how do I...
|
by: D`Jinn Deegee |
last post by:
I have 5 html files say
file1.html
file2.html
:
:
file5.html
Now I have another html file (main.html) where I want to use 1 html
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |