Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Open an html page in an Excel worksheet with VBA

Posted on 2010-08-27
8
Medium Priority
?
534 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
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Independent Software Vendors: 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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

879 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