Solved

Open an html page in an Excel worksheet with VBA

Posted on 2010-08-27
8
516 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
Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

 
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 250 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

631 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