COMate - control COM objects via automation - OBSOLETE!

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
Falko
Enthusiast
Enthusiast
Posts: 271
Joined: Sat Oct 04, 2003 12:57 pm
Location: Germany
Contact:

Post 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)
www.falko-pure.de
Win11 Pro 64-Bit, PB_6.11b1
Bernard
User
User
Posts: 23
Joined: Sun Apr 27, 2003 4:49 pm
Location: France

Post 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
Bernard
User avatar
Falko
Enthusiast
Enthusiast
Posts: 271
Joined: Sat Oct 04, 2003 12:57 pm
Location: Germany
Contact:

Post 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)
www.falko-pure.de
Win11 Pro 64-Bit, PB_6.11b1
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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.
I may look like a mule, but I'm not a complete ass.
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Post by Rings »

only if you post the link to the plus version ;)
SPAMINATOR NR.1
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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
I may look like a mule, but I'm not a complete ass.
cherri123
User
User
Posts: 32
Joined: Tue Apr 13, 2010 5:39 am

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

Post 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
eastken
New User
New User
Posts: 2
Joined: Wed Jun 24, 2015 7:23 am

Re:

Post 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.
Post Reply