Results 1 to 5 of 5
  1. #1
    journeyman is offline Advanced Beginner
    Windows 11 Access 2016
    Join Date
    Dec 2022
    Posts
    82

    Display msgbox in another MS application

    Hi all,



    This may be a curly one, and I don't expect many people to understand what this problem is, let alone provide a solution, however, if you know what I'm talking about, perhaps you might know an answer.

    I am opening a word document from access - easy
    I am detecting events in that word document that can be trapped by access - not so easy.

    The purpose for this is to collect information from a Word form - and feed back new information from the DB into the Word form - and works well.
    I'm sorry to say that I cannot upload this DB dues to variant issues.

    On occasion a change to a word document may create an error - e.g. modifying a date field with the wrong date information. This error is picked up on the Access side.
    Neither the word application object or the Word document object seems to have an error event.

    Becuase I can trap the error on the Access side, is there a way to project a error message box into the word application?
    Or
    Is there a way to trigger the Word msgbox - remember that word is a *.docx file.

    Cheers

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Have you tried
    WordObject.MsgBox ?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Edgar is offline Competent Performer
    Windows 8 Access 2016
    Join Date
    Dec 2022
    Posts
    274
    I don't know if you could trigger a msgbox, but you can easily display a message in the statusbar.
    WordObject.Statusbar = "error happened"

    If you absolutely need to trigger the msgbox, then maybe add a sub to the docx file. Or perhaps you could save something in a general macro library and call it from Access somehow? note I've never done such a thing, it's just an idea.

    If anyone wants to try to solve this, I attached a little playground file for that.
    Attached Files Attached Files

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    The only way I know of is that the code would have to be in the Word document so that you could call it from Access. That won't work with a docx file so I'd say no way to raise a message box in Word by using only Access code. Will be happy to be proved wrong though.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    journeyman is offline Advanced Beginner
    Windows 11 Access 2016
    Join Date
    Dec 2022
    Posts
    82
    Thanks all for answers

    Welshgasman - I've been down the WdApp.msgbox rabbit hole which lead nowhere. It's not a property of the Application class, otherwise, it would be awesome.


    Edgar and Micron. This is an interesting idea - have some code inserted into the doc that triggers, but because it's a docx, that code would have to come out while allowing the save of the doc content, but without attempting to save the event.

    My class stores the word document. maybe there's a way to use that class to store the event? That's a bit out there, but could be a fun excercise. I'll chase it up.

    Thanks for thoughts all.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 11-17-2019, 02:30 PM
  2. Replies: 2
    Last Post: 02-27-2016, 10:59 AM
  3. Replies: 1
    Last Post: 08-27-2015, 06:05 AM
  4. Replies: 1
    Last Post: 07-24-2014, 08:13 AM
  5. OLE Object display application issue/question
    By CaptainCornbread in forum Access
    Replies: 2
    Last Post: 01-05-2012, 09:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums