View Single Post
Old 12-27-2012, 09:49 AM   #57
Start
Enthusiast
Start can program the VCR without an owner's manual.Start can program the VCR without an owner's manual.Start can program the VCR without an owner's manual.Start can program the VCR without an owner's manual.Start can program the VCR without an owner's manual.Start can program the VCR without an owner's manual.Start can program the VCR without an owner's manual.Start can program the VCR without an owner's manual.Start can program the VCR without an owner's manual.Start can program the VCR without an owner's manual.Start can program the VCR without an owner's manual.
 
Start's Avatar
 
Posts: 39
Karma: 197564
Join Date: Dec 2012
Location: Solar System, planet Earth
Device: Tolino Shine 2 HD
Hi everybody! Best Wishes to everybody!

I'm happy to tell you that my time spent in resolving the problem about Why Toxaris macro changes my pointing guillemets into simple Double Quotation Mark has been solved!

I'm NOT used to Macro or VBa but when I see that with a new fresh install of my original Office all is wrong, so I decided to solve this problem and if not, to avoid the macro... I have no Others chances, my books are 50years old and use a lot of pointing guillemets.

Moreover I tested Toxaris macro in a friends commercial office and in their corporate Office all is the same: all is wrong with the wrong carachters. I have no chance. To use or not to use the Toxaris macro?

As I don't know what written in a Macro, I simply deleted a paragraph of Macro in Modify window and tested what happening... then I see that without a piece of code all remained unchanged and so I discovered some stranges number codes in that lines. In internet I find out this marvellous page http://www.elizabethcastro.com/html/.../entities.html


After that I did a long research by Google and I discovered (thanks to Toxaris comments in english for having some words to use in internet) that some carachters have numbers for identifing them in HTML.

After a haedache I tried the "pointing guillemets" numbers instead of original numbers in the Macro and I found out all! All is good!!!!

I inserted these new lines in the Macro and all is ok! Now ALL is the same as the original scanned book.


The Macro code lines were before:

Code:
Function replace_quotes()
'Change smart quotes to HTML entity

Dim oRg As Range

Set oRg = ActiveDocument.Range
StatusBar = "Convert special characters to HTML code..."

With oRg.Find
    .ClearFormatting 
    .Text = "^0145" 
    .Replacement.Text = "‘" 
    .Execute replace:=wdReplaceAll, Wrap:=wdFindContinue 
End With

With oRg.Find
    .ClearFormatting 
    .Text = "^0146" 
    .Replacement.Text = "’" 
    .Execute replace:=wdReplaceAll, Wrap:=wdFindContinue 
End With

With oRg.Find
    .ClearFormatting 
    .Text = "^0147" 
    .Replacement.Text = "“" 
    .Execute replace:=wdReplaceAll, Wrap:=wdFindContinue 
End With

With oRg.Find
    .ClearFormatting 
    .Text = "^0148" 
    .Replacement.Text = "”" 
    .Execute replace:=wdReplaceAll, Wrap:=wdFindContinue 
End With

If Not (oRg Is Nothing) Then Set oRg = Nothing

End Function
and now I have inserted new lines and other comments as all is difficult for me and I hope you appreciate it (I write in my own Language and after that in english too, so no problem for mistakes in translating Macros).

Then I inserted new lines in the Toxaris Macro,
before:

Code:
Sub Transform_HTML()
' This macro converts the active document into a document with HTML tags for layout.
' Version 2.52 - Toxaris
' - fixed center
' - fixed handling empty headers
I've inserted also the right version of Toxaris, the 2.53 instead of 2.52. and now all is as follows:

Code:
Sub Transform_HMTL()
' This macro converts the active document into a document with HTML tags for layout.
' Version 2.54 - Toxaris
' - fixed 2 lost smart quotes to HTML entity causing bugs
' - more comments in smart quotes to HTML entity
' - translation in english of change center
' Version 2.53 - Toxaris
' - fixed center
' - fixed handling empty headers
I have translated from dutch into english this before:

Code:
   'centreer omzetten
    For Each para In ActiveDocument.Paragraphs
        If para.Alignment = wdAlignParagraphCenter Then
'            ParaText = Left(para.Range.Text, Len(para.Range.Text) - 1)
        para.Alignment = wdAlignParagraphLeft
        Set oRg = para.Range
         oRg.MoveEndWhile cset:=vbCr, count:=wdBackward    'enter niet meenemen
            oRg.InsertBefore "<center>"
            oRg.InsertAfter "</center>"
        End If
And using the Google translate I tried to understand what written by Toxaris but I don't understand the meaning, I'm not a skilled guy in coding. However I translated as follows:

Code:
   'change center
    For Each para In ActiveDocument.Paragraphs
        If para.Alignment = wdAlignParagraphCenter Then
'  WHY THIS LINE IS OFF ??? ParaText = Left(para.Range.Text, Len(para.Range.Text) - 1)
        para.Alignment = wdAlignParagraphLeft
        Set oRg = para.Range
         oRg.MoveEndWhile Cset:=vbCr, Count:=wdBackward    'enter not taken ???
            oRg.InsertBefore "<center>"
            oRg.InsertAfter "</center>"
        End If
I have even written "WHY THIS LINE IF OFF" because there is a character that colour all the line code in green and in a Microsoft site there is declared that all green lines are simple comments and not code lines. Maybe is a mistake? I say that because Toxaris usually comments everything and this line is not commented and so it'd be a code and not a comment... sorry but I hope to be useful.

Then I attach here this macro already ready in 2.54 version and I hope Toxaris can approve my work and also that all is ok. I thank you very much toxaris again for this clean work and Microsoft for its online dummies FAQ that permitted to me to debug my problem.

I hope to see this file in the first post by Toxaris and now... stop headache! And well, Best Wishes from me!

Last edited by Start; 12-28-2012 at 08:26 AM. Reason: For english
Start is offline   Reply With Quote