Tuesday, 3 May 2011

PHPBB3 Tables and Excel

One of the forums I currently host and manage makes use of PHPBB3, the user’s post a lot of different tables (league standings e.t.c.) so being able to post tables is a must so I added some BB codes for [table], [tr] and [td] and they can now happily post all the tables they like.

The source data for these tables is held in excel, and having to upload and update 3 different tables each week is a little tiresome so I developed a little VBA Macro that will convert a selection to PHPBB3 Table code.

Throw a button on the toolbar and link it to the macro and job done!



Private Sub CommandButtonClose_Click()
    'closes the form
    End
End Sub

Private Sub CommandButtonCopy_Click()
    'Copies the content of the TextBoxTable
    Dim ansDataO As DataObject
    Set ansDataO = New DataObject
   
    ansDataO.SetText TextBoxTable.Text
    ansDataO.PutInClipboard
End Sub



Private Sub UserForm_Initialize()
    Dim i_ColumnCount As Integer
    Dim i_RowCount As Integer
    Dim i_ColumnLoop As Integer
    Dim i_RowLoop As Integer
   
    'Gets the number of columns / rows in our selection
    i_ColumnCount = Selection.Columns.Count
    i_RowCount = Selection.Rows.Count
 
    'stores the phpbb code
    TextBoxTable.Text = "[table]"
   
    'loops through each row in our selection
    For i_RowLoop = 1 To i_RowCount
        TextBoxTable.Text = TextBoxTable.Text & vbCrLf & "[tr]"
           
        'for each row we loop, now loop through the column
        For i_ColumnLoop = 1 To i_ColumnCount

            TextBoxTable.Text = TextBoxTable.Text & vbCrLf & "[td]"
           
            TextBoxTable.Text = TextBoxTable.Text & Selection.CurrentRegion.Cells(i_RowLoop, i_ColumnLoop).Value
                   
            TextBoxTable.Text = TextBoxTable.Text & "[/td]"
        Next

        TextBoxTable.Text = TextBoxTable.Text & vbCrLf & "[/tr]"
    Next
       
    TextBoxTable.Text = TextBoxTable.Text & vbCrLf & "[/table]"

End Sub


Thursday, 10 February 2011

PHP IIS Got a whole lost easier

I can't remember if I’ve ever blogged about my problems setting PHP up on Windows under IIS, it can be a real headache... sometimes it works as per the documentation, other times (even on a clean server) it doesn't and I end up messing around with all kinds of settings and NTFS permissions, after several system reboots things finally start to work.

Recently I’ve been working on a project that involves using PHP and MSSQL (something I've not done before) it looks like php_mssql.dll is now history (up to PHP v5.2) the latest version of PHP uses a slightly different dll.

To my relief my latest PHP installation was a breeze, fire up the URL below, check all the stuff you want it to install and off it goes, all configured, all working (I wonder what the security is like)

http://www.microsoft.com/web/Downloads/platform.aspx

Wednesday, 19 January 2011

Online document conversion

I needed to convert a PDF document to an image today (didn't want to screen dump it due to resolution loss) after finding 2 or 3 services that boasted they could do the job 'online' and for 'free' (all 3 of which failed or couldn't handle a PDF as large as 1MB) I came across Zamzar. This website can handle a lot of common file conversions (e.g. mov to mpeg e.t.c.) It also features a YouTube video ripper (that could come in handy)

Check it out at http://www.zamzar.com/

Monday, 17 January 2011

Working with PDF’s


Occasionally I get asked to edit and amend some PDF documents, we only have 2 full Adobe Acrobat licenses on site and I don’t have access to one. I can create PDF documents pretty easily from Word and Excel 2007 by using a Microsoft Office Add-in (available here: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=4d951911-3e7e-4ae6-b059-a2e79ed87041&displaylang=en) I can also produce PDF documents from any application that allows you to print by using CutePDF, which installs itself as a printer (available here: http://www.cutepdf.com/)

I few years ago I needed to actually reorder and edit some documents I found the PDF Toolkit Builder (PDFTK) immensely helpful as it allows you to collate and / or split existing PDF documents (you can also stamp and even rotate existing documents) check out PDFTK Builder (available here: http://portableapps.com/apps/office/pdftk_builder_portable)

Thursday, 4 November 2010

None of your e-mail accounts could send to this recipient


Ok I had a very strange email issue today. One of my clients tried sending to various email addresses and kept getting a bounce message with “None of your e-mail accounts could send to this recipient” error. 

After some investigation a number of contacts had been setup to use “MAILTO” rather than “SMTP” (you can check this by double clicking on the contacts name) to resolve the issue I deleted the contact and typed them in, then doubled clicked on them to verify that it had defaulted to SMTP.

Tuesday, 17 August 2010

Form_Load and Textbox.Focus()

I was working on a project recently, where I had MDI forms with SplitContainers and I came across an annoying issue where the Split Containers split bar had the focus, and it made the form look really ugly, so upon load I wanted to set the focus to a textbox, however the normal method of Textbox.Focus() doesn’t seem to work when used inside the Form_Load event, the solution to this is rather simple

Me.ActiveControl = Me.Textbox

Monday, 26 July 2010

Firefox "advert" removal Plug-in


I recently came across a fantastic plug-in for Mozilla Firefox.
Ad-Block Plus lets you toggle adverts on and off, sounds pretty simple and it is. Browsing has become somewhat refreshing recently, not being constantly bombarded by adverts!
If you use Firefox I’d recommend you check it out https://addons.mozilla.org/en-US/firefox/addon/1865/