Printable Version of Topic

Click here to view this topic in its original format

UtterAccess Forums _ Access Automation _ Opening Word From Access

Posted by: aoh May 21 2020, 06:26 AM

Hi guys,

Have a bit of a weird problem. One computer in a network has been having difficulties since yesterday.

I had to go in and reset all the file type associations for the office programs and now, for Access and Excel, when you browse to a document, it shows the correct icon for that file type. However, Word documents show an icon that looks to be notepad, but will open in Word when double-clicked.

My database opens Word documents with a simple line of code:

Application.FollowHyperlink Me.txtFile, , True

Me.txtFile holds the full path to the file. On this one machine (and only this machine), I get the security message "Some files contain viruses... Would you like to open this file?". I say OK and then get "No program is registered to open this file". If I browse to that specific file, I can open it. And yes, the location is in Trusted Locations in Word.

This morning, I uninstalled Office 365, rebooted and reinstalled and it's still the same.

Any ideas?

Posted by: nuclear_nick May 21 2020, 06:57 AM

Could you try instead using a 'Word Object' and opening the file using said Word object? Bit of a pain, but that may bypass Word security features? It also may be that you're opening a 'macro enabled' word file? I've not encountered my users having this problem (yet) because that's the way I did it before discovering the 'application hyperlink', so I just always do it that way anyway.

Posted by: aoh May 21 2020, 07:05 AM

Hi Nick,

Probably could - and will do over the weekend if needs be, but it just looks like the whole Office installation has got corrupted. Also weird that it's just 1 machine when there are 6 or 7 in that office running the same code.

Posted by: nuclear_nick May 21 2020, 07:10 AM

There might be settings the user has that you don't know about as well. Sorry I don't know what those could be... but there could be something. And it might be something that is corrected in a re-install, too.

Always something, ain't it? smile.gif

Posted by: BruceM May 21 2020, 07:13 AM by Daniel Pineault may be of interest. I have been using ExecuteFile for years with no problems.

Important note: The ShellExecute API code in the article will work only with 32 bit Access. If all installations are Access 2010 or later you should use the VBA 7 version as shown Note that the PtrSafe declaration and LongPtr variables work equally well with 32 and 64 bit installations of Office 2010, which is when VBA 7 was introduced. Earlier versions of Access, with VBA 6 and earlier, do not recognize PtrSafe and LongPtr. There is a way around that (conditional compilation). I can provide a link if necessary.

Posted by: nuclear_nick May 21 2020, 08:06 AM


It was certainly of use to me... I liked it... Thanks!