| View previous topic :: View next topic |
| Author |
Message |
Robuis General User

Joined: 23 Jan 2008 Posts: 6
|
Posted: Fri Jan 25, 2008 11:22 am Post subject: DDEPoke Macro just a little help? |
|
|
I am porting a macro to OO, what it needs to do is take the value of a cell and send that to my application via a DDE poke
This all most works.
| Code: | Sub Poke0()
Dim nDDEChannel As Integer
dim document as object
dim x as string
ODocument=ThisComponent
x=ODocument.sheets(0).getcellByPosition(0,0).value
nDDEChannel =DDEInitiate("kepdde", "Channel_1_Device_1")
DDEPoke("1","K0", x )
DDETerminate("1")
End Sub |
The part that doenst work in this is if i write 123 to cell 0,0 it only sends a one?
500 and it sends a 5?
Can some one tell me what I'm doing wrong? _________________ http://www.osdcm.com |
|
| Back to top |
|
 |
Crush4Size Newbie

Joined: 17 Oct 2006 Posts: 4
|
Posted: Tue Jan 29, 2008 4:57 pm Post subject: |
|
|
| does x need to be a string? |
|
| Back to top |
|
 |
Crush4Size Newbie

Joined: 17 Oct 2006 Posts: 4
|
Posted: Tue Jan 29, 2008 5:23 pm Post subject: |
|
|
I did a little looking, I don't know if this ports directly to ooo.
Try Set method for x
Reference the variable nDDEChannel, rather than the value
Sub Poke0()
Dim nDDEChannel As Integer
dim document as object
dim x as string
ODocument=ThisComponent
Set x=ODocument.sheets(0).getcellByPosition(0,0).value
nDDEChannel =DDEInitiate("kepdde", "Channel_1_Device_1")
DDEPoke nDDEChannel,"K0", x
DDETerminate nDDEChannel
End Sub
I googxxx kepdde and found some sample stuff, hope it helps |
|
| Back to top |
|
 |
Robuis General User

Joined: 23 Jan 2008 Posts: 6
|
Posted: Wed Jan 30, 2008 6:22 am Post subject: Thanks, but still cannot get it to work. |
|
|
If I use:
| Code: | Sub R0()
Dim nDDEChannel As Integer
dim document as object
dim x as string
ODocument=ThisComponent
Set x=ODocument.sheets(0).getcellByPosition(6,4).value
nDDEChannel =DDEInitiate("kepdde", "Channel_1_Device_1")
DDEPoke nDDEChannel,"K0", x
DDETerminate("1")
End Sub |
I get the error Object not accessible. Invalid object ref on the Set X line. _________________ http://www.osdcm.com |
|
| Back to top |
|
 |
B Marcelly Super User

Joined: 12 May 2004 Posts: 1414 Location: France
|
|
| Back to top |
|
 |
|