Skip to Content

Web Dynpro OfficeObject with VB Macros

Hi all,

I'm trying to employ an MS Word Template using the OfficeControl. The word template has macros in it, tied to buttons. When this is previewed in the Mime repository, the buttons are there and the macro runs. When the document is called in the WD, the Word document doesn't appear, just a big white box with SAP IOS instead of the place where the document would normally be previewed.

Anyone know why this is and how to fix it?

Thanks in advance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Jan 16, 2012 at 08:27 PM

    are you be able to preview a document with out macros's ? if it is not then you may have some IE security problems with running activeX.

    If you do not have problem then search sios package and there are some examples fro loading macro's.

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 17, 2012 at 09:33 AM

    Which examples in SIOS include Macros? I can't find any.

    After further experimentation, I found that if I have a VB button in the template document, then that shows up in the ActiveX control, and the VB can execute (e.g. popup box...).

    If the document has MergeFields, I can populate these from the WD (like the SIOS example IOS_TEST_WORDPROCESSING

    If the document has the VB Button AND editable fields / merge fields which are getting populated from SAP, then I get an ACF error message.

    **

    My EndGame here is a process that takes a Word Template, populates with SAP data and saves it to a dynamically created folder on the network. All possible using CL_GUI_FRONTEND methods, OLE and all that jazz, however there's not quite so good a relationship with Operating System when using Internet Explorer.

    [cant-i-use-ole-in-webdynpro]

    Since the WD couldn't do it, I was hoping that the VB macros in the Word control would be able to handle the job?

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 20, 2012 at 04:30 PM

    Until I work out otherwise, we're going to put the Macros in the .dot template either on the user's desktop or the network. This makes them available when the ACF screen pops up, and the VB can execute quite happily since it's actually on the Network side rather than coming from SAP's MIME repository.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi, Patrick,

      I know this is a very old post, but I have got similar issues, so maybe you would be able to help. I have the same scenario + we would like to execute the macros directly from ABAP (macro is digitally signed by the customer). This looks impossible once you use setfields( ) method to do the mail-merge (I believe the macro's digital signature is lost then - the ACF protocol shows up the message - not signed).

      I tried opening two documents in the view at once (which looks impossible). When running the macro name ".macroname", it seems to look for .dot template in the default location C:\Users\"USERNAME"\AppData\Roaming\Microsoft\Templates\. We've got Office 2010, so .dotm template should be used. But ACF trace protocol shows a message that word cannot open this template:

      "(c:\users\"USERNAME"\appdata\...\.dot)". In fact, I only suppose the whole path is appdata\roaming..., because the protocol shows only this wrapper. It does not state the name of the file, but I suppose that Normal.dot is what it looks for.

      The office control itselft has a property "DocumentName". I would expect that this property has some meaning, but it seems it does not (if I try to run a macro "RealDocumentName.MacroName" - it states that there is no open document RealDocumentName.

      Now how to force the ACF to look for .dotm instead of .dot? Or did you find any other suitable solution? If I created a .dot template (in an older version of office - which I do not have right now), I suppose I would be able to let the customer to digitally sign the document. But how to distribute this kind of stuff to all the target PCs, that is very confusing (not all the users will have the same version of Office).

      Any push is greatelly appreciates.