Convert Excel to Wap/WML – View in Cell Phone
How do you export Excel data to be viewed from a cell phone or mobile device?
The following is a basic example of using a macro to export one column from an Excel spreadsheet to a Wml(Wireless Markup Language) file, which can be uploaded to your server and accessed from a cell phone.
The experiment: I have a list in column A of Sheet1 in Excel with the track listing from the CD: Perfect Circle – Mer De Noms . First I want to Export the data from Excel in Wml format, second, upload to my server, and finally view the tracklist from my cell phone’s browser. A graphical representation:

To accomplish this I used a VBA macro and Wml. For a basic understanding of Wml I refer you to another tutorial from w3schools.
You can view the final result of my Excel to Wap experiment at the following address:
www.automateexcel.com/pl/wap1.wml
and can do so in your mobile device’s browser, copy and paste the address into a wap emulator, or by viewing this very blurry picture (time for a new digital camera!).
Try it Yourself
1. Copy the following code to a Module in Excel
2. Place some text in Column A of Sheet1 and Save your Workbook
3. Run the Macro
4. A Wml file will be created in the same folder as the workbook you have open.
5. Upload the Wml file to your server and view in cell phone.
Sub WAP()
Dim WapTitle As String
Dim WapName As String
Dim DocType As String
Dim Counter As Integer
DocType = "<!DOCTYPE wml PUBLIC """ & "-" _
& "//WAPFORUM//DTD WML 1.1//EN"" ""http://www.wapforum.org/" & _
"DTD/wml_1.1.xml""" & ">"
'location to write file
WapName = ThisWorkbook.Path & "/wap1.wml"
'Kill the file if it already exists
If Len(Dir(WapName)) > 0 Then
Kill WapName
End If
'get wap title
WapTitle = InputBox("Title", "MyInputTitle", _
"Enter The Title of Your Wap Site")
'exit if no wap title
If WapTitle = "Enter The Title of Your Wap Site" _
Or WapTitle = "" Then
MsgBox "Sorry You Need a Title - Quitting Now"
Exit Sub
End If
'open workbook and write wml header info
Open ThisWorkbook.Path & "wap1.wml" For Append As #1
Print #1, "<?xml version=""1.0""?>"
Print #1, DocType
Print #1, "<wml>"
Print #1, ""
Print #1, _
"<card id=""card0"" title=""" & WapTitle & """>"
Print #1, ""
Print #1, "<p>"
'loop through sheet1, write contents
For Counter = 1 To ActiveSheet.UsedRange.Rows.Count
If Not IsEmpty(Sheet1.Cells(Counter, 1)) Then
Print #1, Sheet1.Cells(Counter, 1) & "
"
End If
Next Counter
'write wml footer info and close
Print #1, "</p>"
Print #1, ""
Print #1, "</card>"
Print #1, "</wml>"
Close #1
End Sub
Credit: “Write to text file” code is a derivative of J-walk’s log users.
Conclusion: After my short introduction to Wml it also appears feasible to create multiple pages from data, and create a menu of links for multiple sets of data. I would also like to research an application to present the user with a way to search a large dataset exported from Excel data.
Any opinions or ideas on the topic of exporting Excel to Wml, particularly possible uses, or other thoughts?