Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Trying to make a form for SEO.

Hello,
My name is Adam and I am a current SEO Researcher for a company called
Purple Trout.
I am currently trying to create a userform in excel that has three
command buttons and a textbox. Names are as follows:
txtBox1
cmdKeywords
cmdTitles
cmdDescriptions

The purpose of the textbox would be to input a URL. Purpose of
commandButton named Keyword is to search the URL's source code for the
list of HTML meta keywords and paste them into a sheet of excel.
Purpose of the cmdTitles commandButton is to search URL's source code
once again for the HTML Title, and the same goes for the description
with HTML description. I have successfully done the easy part and
created the form but have yet to find a way for the program to grab
each part of the source code and paste it into excel. Any help would
be great!
Thanks,
Adam
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Trying to make a form for SEO.

On Jul 16, 2:07*pm, SEO_CodeMan wrote:
*Hello,
My name is Adam and I am a current SEO Researcher for a company called
Purple Trout.
I am currently trying to create a userform in excel that has three
command buttons and a textbox. Names are as follows:
txtBox1
cmdKeywords
cmdTitles
cmdDescriptions

The purpose of the textbox would be to input a URL. Purpose of
commandButton named Keyword is to search the URL's source code for the
list of HTML meta keywords and paste them into a sheet of excel.
Purpose of the cmdTitles commandButton is to search URL's source code
once again for the HTML Title, and the same goes for the description
with HTML description. I have successfully done the easy part and
created the form but have yet to find a way for the program to grab
each part of the source code and paste it into excel. Any help would
be great!
Thanks,
Adam


Adam,

There is quite a bit of information available on IE Automation. You
can actually do a search on "IE Automation". (I noticed that Tim
Williams posted a lot to these, so I started reading/searching for his
posts; I learned quite a bit from his posts). A very crude way is
below, but again, depending on the source code, you can target the
code more specifically. I've never done any web page development, so
I'm limited in knowledge, but I do know that web pages have tags and
you can use this to your advantage. A "tag" method is below, so play
around with the code and the potentiality of needing nested loops.
The code below will print the innertext of <a href... tags.

Note: I have not tested the code.

Best,

Matthew Herbert

'----------------------------------------------------
'GET IE OBJECT WITH URL
Sub TestIE()
Dim objIE As Object
Dim objTag As Object
Dim strNavigate As String

strNavigate = UserForm1.TextBox1

Set objIE = CreateObject("InternetExplorer.Application")
objIE.Visible = True
objIE.Navigate strNavigate
WaitForLoad objIE

End Sub

Sub WaitForLoad(IE As Object)

Do Until IE.Busy = False And IE.ReadyState = 4
Application.Wait Now() + TimeValue("0:00:01")
DoEvents
Loop
End Sub
'----------------------------------------------------

'----------------------------------------------------
'WITHIN YOUR COMMANDBUTTON CLICK EVENTS
'RUN SOMETHING LIKE THE FOLLOWING:

Private Sub CommandButton1_Click()
Dim objIE As Object

Set objIE = GetIE(UserForm1.TextBox1)
For Each objTag In objIE.document.all.tags("a")
'your code here
'you'll want to get the innertext of the object
'you may need to set up nested loop(s)
'setup an output to your worksheet here
Debug.Print objTag.innertext
Next objTag
End Sub

Function GetIE(sAddress As String) As Object

Dim objShell As Object, objShellWindows As Object, o As Object
Dim retVal As Object, sURL As String

Set retVal = Nothing
Set objShell = CreateObject("Shell.Application")
Set objShellWindows = objShell.Windows

'see if IE is already open
For Each o In objShellWindows
sURL = ""
On Error Resume Next
sURL = o.document.Location
On Error GoTo 0
If sURL < "" Then
If sURL Like sAddress & "*" Then
Set retVal = o
Exit For
End If
End If
Next o

Set GetIE = retVal
End Function
'----------------------------------------------------
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
make the form execute file ppyxl[_15_] Excel Programming 2 July 19th 06 10:12 AM
how to make form layouts carole New Users to Excel 1 June 11th 06 06:29 AM
How to make Form Modeless Jim May Excel Programming 2 February 24th 06 11:40 AM
how to make a form self disappear Ben Excel Programming 1 November 18th 05 09:21 PM
how can I make a form number change everytime the form is opened babydumplingspita Excel Worksheet Functions 1 October 10th 05 07:58 PM


All times are GMT +1. The time now is 02:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"