Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Open an html page in an Excel worksheet with VBA

Posted on 2010-08-27
8
Medium Priority
?
525 Views
Last Modified: 2012-05-10
How can I open an HTML page in a specific worksheet with Excel VBA? I currently do an import which works ok, but I wanted to keep the original page.
0
Comment
Question by:bellboy2k
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 10

Expert Comment

by:MaduKp
ID: 33540200
0
 

Author Comment

by:bellboy2k
ID: 33540215
Thanks, but I found that same article. I need the HTML file to open in a Worksheet.
0
 
LVL 17

Expert Comment

by:calacuccia
ID: 33540350
In a new workbook, it's fairly easy.

Dim mb As Workbook
Set mb = Workbooks.Open("http://www.printware.co.uk/Products/Result-Groups.html?searchtext=A0DK152")

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 17

Expert Comment

by:calacuccia
ID: 33540368
Dim mb As Workbook
Set mb = Workbooks.Open("http://www.printware.co.uk/Products/Result-Groups.html?searchtext=A0DK152")
'The line below moves the workbook to a new sheet before Sheet1 in ThisWorkbook, which is the workbook from which you call the VBA macro
mb.Worksheets(1).Move ThisWorkbook.Worksheets("Sheet1")
0
 

Author Comment

by:bellboy2k
ID: 33540408
That worked, but how do I get it to load ina a specific Worksheet, I have a report that runs every morning and I have an HTML page that I need to load into a specific Worksheet called EDLC from a local folder, let's say c:\test\edlc.mht.
0
 
LVL 17

Accepted Solution

by:
calacuccia earned 1000 total points
ID: 33540455
With this type of macro it should open the other book, move the webpage into that book, delete the old EDLC page and rename the new page to EDLC.

Dim mb As Workbook
Dim otherB as workbook
Dim newS as worksheet
Set mb = Workbooks.Open("http://www.printware.co.uk/Products/Result-Groups.html?searchtext=A0DK152")
Set otherB = Workbooks.Open("c:\test\edlc.mht.xls")
'The line below moves the workbook to a new sheet before Sheet1 in ThisWorkbook, which is the workbook from which you call the VBA macro
mb.Worksheets(1).Move otherB.Worksheets("EDLC")
Set newS = ActiveSheet
otherB.Worksheets("EDLC").Delete
newS.Name = "EDLC"
0
 
LVL 5

Expert Comment

by:INHOUSERES
ID: 33540503
Would this work?
Range("A1").LoadText("c:\test\edlc.mht")

Open in new window

0
 

Author Closing Comment

by:bellboy2k
ID: 33540509
Thanks calacuccia for the solution and the quick response!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

671 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question