June 22, 2024, 05:01:26 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Help with COM automation

Started by Locodarwin, January 08, 2008, 12:59:40 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Locodarwin

I’m having a little trouble getting out of the gate with COM automation using EB.

In VB/VBA, if one wanted to perform simple automation of MS Word via COM, for example, one might write a snippet such as this:


Dim wdApp As Word.Application
Dim myDoc As Word.Document
Dim mywdRange As Word.Range

Set wdApp = New Word.Application    â€ËÅ" Create the Word application object

wdApp.Visible = True
wdApp.WindowState = 1

Set myDoc = wdApp.Documents.Add     â€ËÅ" Create a new document inside the word application
Set mywdRange = myDoc.Words(1)

mywdRange.Text = Range("F6") & " This is a test."
mywdRange.Font.Name = "Comic Sans MS"
mywdRange.Font.Size = 12
mywdRange.Font.ColorIndex = 5
mywdRange.Bold = True


If someone could show me code/procedure in EB that mimics the above code, so that I may study it, I’d be grateful.  :)

Thanks,

-S

sapero

January 08, 2008, 05:39:51 AM #1 Last Edit: January 08, 2008, 10:40:52 AM by sapero
Hello,

I've attached the code for EB. Unfortunately I don't know what is Range("F6"), but all other is working.
You'll need to install the SDK headers in order to compile the code.
The file wordapp.inc contain only a bit of the whole Word interface.

Locodarwin

Thanks, sapero - that's precisely what I was looking for.

-S