Page 39 of 39

Posted: Mon Apr 06, 2009 10:31 am
by Falko
I hope, this can help for you.


Please use my ExcelFunctions.pbi : http://www.purebasic.fr/german/viewtopi ... 466#239466
Sorry, AddWorksheetAfter() and RechtsMarkieren() i could not convert to COMate, but all
another Functions :)
You must in ExcelFunctions.pbi correct the Path from Comate.pbi.

Code: Select all

EnableExplicit

XIncludeFile "ExcelFunktion.pbi"

ExcelObject=OpenExcelFile("C:\Users\Falko\Desktop\ExcelProgramm\",#True)
ExcelVisible(ExcelObject,#True); You can see Excel
WriteCenterHeader(ExcelObject,"&"+Chr(34)+"Arial,Fett"+Chr(34)+"&25&TMyCenterHeader")
saveAsWorkbook(ExcelObject,"C:\Users\Falko\Desktop\ExcelProgramm\TestCenterHeader.xls")
CloseWorkbook(ExcelObject)
CloseExcelAll(ExcelObject)

Posted: Mon Apr 06, 2009 1:54 pm
by Bernard
My problem is the title begin with a numeric char

Code: Select all

      TMyCenterHeader.s = "24 Heures"
      WriteCenterHeader(ExcelObject,"&"+Chr(34)+"Arial,Fett"+Chr(34)+"&18&" + TMyCenterHeader) 
I try some tests but I haven't found the solution

Posted: Mon Apr 06, 2009 9:43 pm
by Falko
Follow is for the Fontset: &"Arial,Fett" ("Fett" in english "grease"). Sorry, but i've german Excel.

Behind the Fonthight, you write: &25
Behind for underline string, you write &T
behind you write your Text, you can see.

This must be write to one String in this Function.

MyCenterHeader.s= "&"+Chr(34)+"Arial,Fett"+Chr(34)+"&25&T" ; for your Fonts and so on
MyCenterHeader + "24 Heures"; here you can write your String

Then you give this to:

WriteCenterHeader(ExcelObject,MyCenterHeader)

Code: Select all

;Please use my ExcelFunctions.pbi :  http://www.purebasic.fr/german/viewtopic.php?p=239466#239466
;Sorry, AddWorksheetAfter() and RechtsMarkieren() i could not convert to COMate, But all
;another Functions :)
;You must in ExcelFunctions.pbi correct the Path from Comate.pbi.
EnableExplicit
XIncludeFile "ExcelFunktion.pbi"

ExcelObject=OpenExcelFile("C:\Users\Falko\Desktop\ExcelProgramm\",#True)
ExcelVisible(ExcelObject,#True); You can see Excel

MyCenterHeader.s= "&"+Chr(34)+"Arial,Fett"+Chr(34)+"&25&T" ; for your Fonts and so on  
MyCenterHeader + "24 Heures"; here you can write your String

WriteCenterHeader(ExcelObject,MyCenterHeader)
saveAsWorkbook(ExcelObject,"C:\Users\Falko\Desktop\ExcelProgramm\TestCenterHeader.xls")
CloseWorkbook(ExcelObject)
CloseExcelAll(ExcelObject)

Posted: Fri Apr 24, 2009 2:19 pm
by srod
Announcement - 24th Apr. 2009.

COMate is now obsolete and unsupported!

That's right folks; I will no longer be supporting or updating COMate.

The good news, however, is that I shall be supporting COMatePLUS which has just been released and for which a forum announcement is imminent!

:)


@Moderators : could you please lock this leviathan of a thread as I do not wish to confuse the old versions of COMate with COMatePLUS when I give support etc.

Thanks in advance and thank you to all who have helped out in one way or another with COMate.

Posted: Fri Apr 24, 2009 3:03 pm
by Rings
only if you post the link to the plus version ;)

Posted: Fri Apr 24, 2009 3:08 pm
by srod
Rings wrote:only if you post the link to the plus version ;)
A might fine point there Mr. Rings! :)

Doh!

http://www.purebasic.fr/english/viewtop ... 157#284157

Re: COMate - control COM objects via automation - OBSOLETE!

Posted: Sat Nov 13, 2010 7:28 am
by cherri123
who to me will prompt as in vorde to change the fields of sheet
here code that at me here not so

Code: Select all

XIncludeFile "COMatePLUS.pbi"


Define.COMateObject WordObject,oDoc,ot
WordObject = COMate_CreateObject("Word.Application")

If WordObject
  Debug "WordObject [init]"
  If WordObject\SetProperty("Visible = #True") = #S_OK

    oDoc = WordObject\GetObjectProperty("Documents\Add")
    Debug oDoc
    p=oDoc\SetProperty("ActiveDocument\PageSetup\LeftMargin=CentimetersToPoints(1.5)")
    Debug p
    If oDoc
      Debug "oDoc [init]"

      ot=oDoc\GetObjectProperty("Content\Paragraphs\Add")
      If ot
        Debug "ot [init]"
        
        ot\SetProperty("Range\Font\Bold = #True")
        ot\SetProperty("Range\Font\Size = 11")
        ot\SetProperty("Range\Text = '123'")
        ot\SetProperty("Format\SpaceAfter = 1")
        ot\Invoke("Range\InsertParagraphAfter()")
        ot\SetProperty("Range\Text = '321'")
      EndIf
    EndIf
  EndIf
EndIf

Re:

Posted: Tue Jun 30, 2015 7:55 am
by eastken
srod wrote:Read the bloody manual you idiot!

:twisted:

In a command string, single quotes are used to signify a string parameter (which COMate needs to identify up front). I used a single quote instead of double quotes to make it easier to use PB's string functions etc.

Now this of course means that we cannot enter any single quotes within our command strings - at least not directly. Because of this COMate allows you to use 'escape codes' of the form $xxxx where xxxx denotes a hexadecimal unicode character code. For single quotes use $0027 (asc code 39).

So your latest code should read :

Code: Select all

SujetMail = "Envoi d$0027un mail" <---- A quote is present in this line 
MailNote\SetProperty("Subject = '" + SujetMail + "'")
Now, any more problems and you know what to read first before hitting the post button! :wink:
Thank you for your post, it's a much helpful reference for my similar issue.