Using VBA to Create Custom Web Pages

Long before Microsoft introduced the Save as Web Page functionality, people had been using VBA to take Excel data and publish it as HTML. The advantage of this method is that you can write out specific HTML statements to display company logos and navigation bars.

Consider a typical Web page template. There is code to display a logo and navigation bar at the top and/or side. There is data specific to the page, and then there is data to close the HTML file. Build an HTML template with the words "PUT DATA HERE" and examine the resulting HTML in Notepad, as shown in Figure 14.12.

Figure 14.12

Examining the sample.html file in notepad and locating the words "PUT DATA HERE" allows you to separate the HTML file into three pieces:the top portion of the code used to write the navigation bar, the data, and the bottom portion used to close the HTML page.

Figure 14.12

Examining the sample.html file in notepad and locating the words "PUT DATA HERE" allows you to separate the HTML file into three pieces:the top portion of the code used to write the navigation bar, the data, and the bottom portion used to close the HTML page.

After you examine the code in Notepad, the task of creating a custom Web page is fairly simple. First, write out the HTML needed to draw the navigation bars. Then write the data from Excel. Then write the few lines of HTML to close the table and finish the Web page.

0 0

Post a comment