Vba makro för omvandling Excel till html

Hej!

Jag har skrivit ned innehållet av kyrkböckerna i kolumner i Excel. Jag har försökt länka ihop och spåra "alla" personer som jag skrivit ned, därför går det långsamt. Dessutom skriver jag ned dopvittnena, som brukar vara till stor hjälp när man ska spåra dem som är svåra att hitta. Det har varit lite av ett evighetsjobb, men en fördel med Excel är att man kan använda autofilterfunktionen. Med den kan man söka kolumnvis, tex. efter alla i en viss gård, eller med en viss förälder.

Från Excel kan man spara innehållet till htlm, men koden man får är väldigt uppblåst, ful och omöjlig att läsa och korrigera.
Så för att lösa detta på ett bättre sätt så skrev jag ett makro i Excel som sparar innehållet på ett simpelt och okompicerat sätt. För formatteringen använder jag istället s.k. CSS "Cascading Style Sheets". För att kunna tillgodose olika önskemål i framställningen hittade jag dessutom ett sätt att via ett java-skript växla mellan olika sådana formatteringar, så att man, som i mitt fall, dynamiskt kan ändra på storleken för texten.

Enda 'problemet' är att Internet Explorer av tradition är dåligt på att supporta CSS på riktigt sätt. Därför blir resultatet i andra Webb-läsare som följer moderna standarder oftast bättre. Förhoppningsvis ska nya versioner av IE bli bättre på detta.

Jag är faktisk riktigt nöjd med resultatet, därför denna utläggning. Om någon har en liknande uppgift och är intresserad av mitt makro-programm så kan ni skriva en rad per mejl.

Tillbaka till avskrifterna .

Vba macro for transfering Excel data into html

Hello!

I have transcribed the content of a few ministerial books into columns in MS Excel. When doing this I also tried to indentify each person and his/her relations. That is why the works has taken a long time. For the birth record I also record the godparents (witnesses) and their data. Who they are gives additional clues when it is hard to identify a person, so I hope this extra effort was worthwhile. In Excel it is quite useful to use the "autofilter" function to sort data for i.e. parents names or farm names.

From Excel it is also possible to save the data straight into an html table. However, the resulting core is extremely bloated, ugly and impossible to read when trying to change something in the source code.
To cure this I decided to write an Excel macro i Vba to create a slim and simple html code - my way. For the formating i use CSS "Cascading Style Sheets". To fulfill different wishes about the presentation of the tables I also found a nice way to change the layout of the data dynamically using a java script that switches between different stylesheets. I have impemented one with larger text to improve readability and one with smaller text for better overview.

The stylesheets work best with Web browsers that are fully compatible with CSS. By tradition the MS Internet Explorer is not very good at keeping to those standards. I tried with IE8 and most functions work, but not as well as with i.e. Firefox. Hopefully coming versions of IE will improve on this.

I am pretty happy with the result, and how easy I was able to get from from the excel data to these pages using the Vba macro. If you have a similar task you may write me an email for more information on how to do this.

Back to the transcriptions.

/Karl-Henrik Rydén 2010-11-28