Back to Four Js Website
Four Js Customer Forum
Subscribe for automatic updates:
RSS
Sign in for full access
|
Help
Four Js Development Tools Forum
>
Discussions by product
>
Genero BDL
>
wincom and Word
Most recent posts
Pages: [
1
]
« previous
next »
Reply
|
Print
Author
Topic: wincom and Word (Read 14104 times)
Stefan S.
Posts: 90
wincom and Word
«
on:
June 12, 2009, 09:21:44 am »
Hello List,
Documents.Open FileName:="z:\brief.doc"
the line above is a part of a VB-Makro in Word (it works!)
how can I write this line in Genero-syntax ?
I trieyd several versions
f.e.:
CALL ui.interface.frontCall("WinCOM", "CallMethod",
[wwapp, 'Documents.Open FileName("z:\brief.doc")'], [wwdoc])
But I always get this error
One or more of the names were not known. The returned array of DISPIDs contains DISPID_UNKNOWN for each entry that corresponds to an unknown name.
Exit with COM Error.
open an empty document works fine
CALL ui.interface.frontCall("WinCOM", "CallMethod", [wwapp, "Documents.Add"], [wwdoc])
I think it has to do with parameters for the method I am calling, but what is the correct syntax ?
thanks
Stefan
Paul S.
Posts: 45
Re: wincom and Word
«
Reply #1 on:
June 12, 2009, 09:55:29 am »
Hi Stefan,
try
CALL ui.Interface.frontCall("WINCOM","CallMethod", [wlapp,"Documents.Open",l_f],[wdoc])
where l_f is a STRING containing the file name
Paul
Stefan S.
Posts: 90
Re: wincom and Word
«
Reply #2 on:
June 12, 2009, 11:39:54 am »
Thanks Paul,
it works like you wrote:
let str = 'z:\brief.doc'
CALL ui.interface.frontCall("WinCOM", "CallMethod", [wwapp, "Documents.Open", str], [wwdoc])
but the Method "Documents.Open" has more Parameter. A complete VBA-Statement looks
is f.e.:
ChangeFileOpenDirectory "Z:\"
Documents.Open FileName:="brief.doc", ConfirmConversions:=False, ReadOnly _
:=False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate _
:="", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="" _
, Format:=wdOpenFormatAuto
How can I submit other Parameters to Word ??
The same Problem I have with the "goto" Statement
Goto a LineNumber 8 in VBA: Selection.GoTo What:=wdGoToLine, Which:=wdGoToFirst, Count:=8, Name:=""
Goto a BookMark plz_ort: Selection.GoTo What:=wdGoToBookmark, Name:="plz_ort"
Thanks Stefan
Paul S.
Posts: 45
Re: wincom and Word
«
Reply #3 on:
June 12, 2009, 12:00:37 pm »
Hi Stefan,
to be honest its a little hit and miss at times. I (and a few others) have spent hours looking at what VB does to connect to Word/Excel extra. There are loads of examples on the Internet (just use google), also MS has on-line documents to example most of the methods for MS-Office.
I have attached the lib. module we use to Word, most of it works, some I give up on (no time to finish).
For bookmarks I do:
FUNCTION word_com_bookmark(l_find)
DEFINE res,lin INTEGER
DEFINE l_find STRING -- BookMark
DEFINE l_arg STRING
LET m_para = l_find.trim()
LET l_arg = "ActiveDocument.Bookmarks(",g_quote.trim(),l_find.trim(),g_quote.trim(),").Select"
CALL ui.Interface.frontCall("WINCOM","CallMethod",[wlapp,l_arg.trim()],[res])
IF word_com_error(1,res, __LINE__) THEN
RETURN FALSE
END IF
RETURN TRUE
END FUNCTION
Paul
word_com.4gl
(18.1 KB - downloaded 974 times.)
.
Posts: 115
Re: wincom and Word
«
Reply #4 on:
June 12, 2009, 12:30:25 pm »
Without having tried, I would suggest to use the () notation for function calls:
Document.Open(foo, bar)
instead of
Document.Open foo bar
VBScript is, as the name state, a complete scripting language ; GDC WinCOM API is just a bridge between 4GL and the pure WIN32 COM API, so basically we have our own script parser which is not as extented as the one from Microsoft (if anyone knows how to integrate the one from Ms in C++ application...)
So this is one of the major limitation of WinCOM API: the parser could be smarted, but we're running out of time to improve it.
The other one is data type limitation: frontCalls are only based on INTEGER / STRINGs, so we've made some internal tricks to support handles, but this works only in a strict and defined context.
So - again, without having tested, sorry - I would use:
CALL ui.interface.frontCall("WinCOM", "CallMethod",
[wwapp, 'Documents.Open("z:\brief.doc")'], [wwdoc])
The := notation is supported, but not mandatory.
HIH,
regards,
Pierre-Nicolas
Stefan S.
Posts: 90
Re: wincom and Word
«
Reply #5 on:
June 12, 2009, 12:45:59 pm »
Thanks Paul,
I will have a deeper look to your word_com lib. I think there are many intresting statements.
I even spent a lot of time with searching for the correct syntax, but without much success.
Do you have some links (Excel an Word)
Stefan
Paul S.
Posts: 45
Re: wincom and Word
«
Reply #6 on:
June 12, 2009, 12:55:16 pm »
Hi Stefan,
some links I have used are:
http://www.neng.usu.edu/cee/faculty/gurro/VBA&Excel.htm
http://msdn.microsoft.com/en-us/library/bb726434.aspx
http://msdn.microsoft.com/en-us/library/bb190882(office.11).aspx
This last one was a helps with a problem if the application aborts or does not close.
http://www.tushar-mehta.com/excel/vba/xl_doesnt_quit/
For Excel I have limited myself to using the clipboard to copy and paste from an array, there are already a few examples of this on the board.
Paul
Paul S.
Posts: 45
Re: wincom and Word Excel
«
Reply #7 on:
June 12, 2009, 01:01:05 pm »
Hi Stefan,
my excel.4gl lib. function.
most of it is copied from what other people have posted in the past.
Paul
excel.4gl
(52.01 KB - downloaded 1036 times.)
Pages: [
1
]
Reply
|
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> General Discussion
=> Ask Reuben
=> WWDC21
-----------------------------
Discussions by product
-----------------------------
=> Products announcements
=> Genero BDL
=> GWS
=> GAS and GBC
=> GDC
=> Genero Mobile for Android or iOS
=> Genero Studio
=> Reporting tools (GRW, GRE)
-----------------------------
Jobs
-----------------------------
=> Jobs
Powered by SMF 1.1.21
|
SMF © 2015, Simple Machines
Loading...