See also ebooksgratis.com: no banners, no cookies, totally FREE.

CLASSICISTRANIERI HOME PAGE - YOUTUBE CHANNEL
Privacy Policy Cookie Policy Terms and Conditions
Wikipedia:Helferlein/VBA-Macro for EXCEL tableconversion – Wikipedia

Wikipedia:Helferlein/VBA-Macro for EXCEL tableconversion

aus Wikipedia, der freien Enzyklopädie

Für die Deutsche Version dieses Textes, siehe Wikipedia:Textverarbeitung/EXCEL-Tabellenumwandlung

Inhaltsverzeichnis

[Bearbeiten] Description: VBA-Macro for EXCEL tableconversion

This is version V1x of EXCEL-VBA-Macro format_as_wikitable. This Macro converts any selected range of cells into wiki-text, that are copied via the clipboard into the wiki-editor.

[Bearbeiten] Functional reference

  • Converts an arbitrary selected cellrange into wiki table format with all essential formatting information
    • fontsize, color, style (italic, bold, underlined)
    • background color of the cell
    • text aligment in the cells (horizontal and vertical)
    • column width and row height
  • further on the wiki output is size optimized; that means the cell formatting code is only repeated if necessary, e.g. when another formatting option has been active on the line cell before the actual cell
  • because the frameformatting concepts of EXCEL and Wiki-table are not compatible, the frame-formatting is not converted - sorry for that.

Comments and possible errorreports should be posted under discussion.

[Bearbeiten] VBA-Source

Please copy the VBA-Source from here

[Bearbeiten] Tips for usage

[Bearbeiten] Optimize your formatting in EXCEL to get better results

Some problems and limitations in representation are listed below. An overview about representation power of this tool you get here.

[Bearbeiten] Limits in rendering

This macro aims to convert a EXCEL-table as near to wikicode as possible. Ideally the table is rendered identically in both table-representation-clients. Differences in the rendering concepts of EXCEL and wiki-table limit this goal in certain areas:

  • Cell formatting: In EXCEL each cell can have its individual frame information on all four sides. This is not possble in wiki-table, where the framing is defined on a tablewide standard formatting.

[Bearbeiten] Avoid formats in EXCEL that lead to unwanted results

An EXCEL table that is parsed with VBA-code returns the cell content programmatically differently under certain circumstances, as it is visually rendered.

The following known problems can be avoided by used explicit different EXCEL formatting options:

  • Locale Non-US date formats are not correctly exported by the EXCEL Macro interface of Microsoft. There is no known solution to this.
  • Number format Standard should be avoided. Content of such cells is not exported correctly by EXCEL-Macro interface of microsoft; e.g. the number "1000" will be exported as "(1000)".

[Bearbeiten] Avoid Rendering conflict due to differences in default formatting rules between EXCEL and wiki-table

There are some differences in default formatting rules between EXCEL and wiki-table, which will lead to implicit changes in the cell rendering. These conflicts can be avoided by using explicit formatting rules in EXCEL. You will have to override the EXCEL defaults by explicitly using attributing formats. You will see no difference in EXCEL, the difference will only emanate when rendering the converted wiki-output. This mainly concerns

  • Horizontal alignment
  • Vertical alignment

[Bearbeiten] How to use this VBA-Macro

In short: Select the macrotext above, insert it into a EXCEL/VBA-Modul and start. If more details are needed, follow the instructions below, the commands may vary slightly depending on your excel version:

  1. With Excel use: File > Open and open the .xls file of the spreadsheet table you want to convert.
  2. Open the macro-editor (menu: Special/Macro/Visual-Basic-editor) or 'Alt-F11'
  3. In the left window you should see the open VBA-Projects in the Project-Explorer. If not open that subwindow with CTR-R or View>ProjectExplorer.
  4. There you right-click on 'VBA-Project' with the cursor placed at the name of your actual document
  5. In the context menu use Insert/Module
  6. Somewhere eg. in the right you will get a popup window with a empty white area, with two dropdownboxes on the top (General and Declarations)
  7. Select the entire vba-Code above and insert it into that empty white area. Later when saving this you will actually create a new module.
  8. Go back to your worksheet, do the final formatting of your table, then select the cellrange you want to convert into a wiki-table.
  9. Execute the macro format_as_wikitable (On the menu select "Tools/Macro/Macros...". A dialog box with the title "Macro" will appear. Click the name "Format_as_wikitable" in the list, then click the "Run" button.)
  10. A new worksheet with name "Wikioutput" is created, where the wikitext is written
  11. Copy this text via clipboard into the wiki-editor
  12. Use the preview function of the wiki-editor
  13. When you are satisfied with the results save your wiki-work
There might be some slight differences in your default window-layouts in VBA-Editor. Please also keep in mind that I am working on a german EXCEL-Installation. Although the menu pathnames etc. are somewhat blindly translated into english it is possibile to improve on the english installation.

Comments or any problems may be posted to Discussionpage, which is on my watchlist. --ollio 13:21, 10. Apr 2006 (CEST)

[Bearbeiten] Using the macro as EXCEL-Add-in

You can also store an EXCEL-file with the macro-code as an XLA-addin-file. Thereafter you can use the macro as a addin-command, so you don't have to copy it into each file where you want convert a table.

Howto install a macro as EXCEL-Add-in:
First you install the macro in file, with an empty worksheet. You can then generate a XLA-Addin File:

  • Save this file as XLA-Addin: File > SAVE as. In the SaveAs-Dialog you have to change the filetype to XLA.
  • Give the XLA-File a meaingfull name (e.g.: Writewikitable.xla). The path of the file is automatically changed to C:\Own documents\myUsername\application data\Microsoft\AddIns. Save the file now.
  • Close EXCEL and reopen it
  • Under Extras > Addins you will now see your newly created XLA-Addin. You must activate it by its checkbox
  • The macro Format_as_wikitable is now available - even it is not visible under Extras > Macro > Execute.

Of course it's now troublesome to tiping blindly the macroname everytime you want to use it. To help yourself you can create a userdefined menuentry and assign this macro to it. --ollio 20:57, 16. Okt. 2006 (CEST)

[Bearbeiten] Samples of created output: Link to the gallerie

69.159.107.152 has added an sample of created output. It has been transferred to the gallerie. Please trim your samples not be too big. --ollio 09:36, 5. Nov. 2006 (CET)

Date Timings Technology Vanu Specific Brian's Hands-On Sessions Presenter
19-Jun 11am - 1pm Product Overview and Base Packages Shashank
4-5 pm GSM Channel Structure; Radio Interface Prasanna
5-5:30 pm Paging and Call Setup Nikhil
5:30-6 pm Call Release and Handover Shashank
22-Jun 11am - 1pm Chiswick BSC Prasanna
3 - 5 pm PCU Overview Jeremy
Weekend
25-Jun 11am - 1pm Chiswick BTS Nikhil/Prasanna
4 - 6 pm GPRS Overview Shashank
Developer Walkthrough Brian
26-Jun 4 - 6 pm GPRS Channel Structure; Radio Interface Prasanna
27-Jun 11am - 1 pm vista Nikhil
vibitstream Prasanna
GSMMessaging Shashank
28-Jun 4 - 6 pm RLC Neeraj
29-Jun 11am - 3 pm GPRS Messaging Prasanna
viconfig Nikhil
sprokit Jeremy
vipthread Shashank
Weekend
2-Jul 4- 6 pm MAC Nikhil
4-Jul 4-5 pm Gb Interface Nikhil
5-6 pm BSSGP, NS Layer Neeraj
5-Jul 3-4 pm SepiaNet Neeraj
3-4 pm tools Nikhil
4-5 pm spEtherIo Prasanna
4-5pm SpInout Shashank
Weekend
9-Jul 11-1 pm TCH Establishment Neeraj
10-Jul 11 -1 pm UL TBF Establishment Nikhil
11-Jul 11 -1 pm Scenario ?? All
12-Jul 11 -1 pm Scenario ?? All


aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -