Link to home
Create AccountLog in
Avatar of chestera
chestera

asked on

Word and access 2013

Hi EE

Still having trouble opening word in access 2013. I have the following

Dim db As DAO.Database, rs As DAO.Recordset
    Dim search
    Set db = CurrentDb
    search = "SELECT * FROM tblConfig WHERE [ConfigID] = " & 1
    Set rs = db.OpenRecordset(search)
    DocLocation = rs.Fields("DocumentLocation")
    OrgID = Me!txtOrgID
    Organisation = Me!txtOrgname
    DocFileName = "HO" & OrgID & Organisation & ".docx"
    If Right(DocLocation, 1) = "\" Then
        path = DocLocation & DocFileName
    Else
        path = DocLocation & "\" & DocFileName
    End If

   Dim wrdApp As Word.Application
   Dim wrdDoc As Word.Document
   
    If Dir(path) <> "" Then
           Set wrdApp = CreateObject("Word.Application")
           wrdApp.Visible = True
           wrdApp.Activate
           Set wrdDoc = wrdApp.Documents.Open(path)
           wrdDoc.Application.WindowState = wdWindowStateMaximize
           wrdDoc.Activate
    Else
            MsgBox ("There is no Document for this project"), vbOKOnly, "Message"
   
    End If

At the moment wdWindowsState is maximised, I have tried Normal When I run word opens in the background (Underneath the opening form)
Before I introduced the line wdWindowsState word would open minimised. I just want word to allways open over the access form. I have made form Popup and model = no. If I transfer the code and run access 2003 there is no problems. Any help appreciated

chestera
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of chestera
chestera

ASKER

Ryan Chong

Thank you Ryan I will give it a try and get back to you. I will be away from PC for a while

Alan
Ryan Chong

Sorry for the delay I have been away. Tried your Shell routine this morning and it worked. Many thanks.
I hope you don't mind before I close off I have a minor problem unrelated to word. I have asked the question before some months ago and couldn't get an answer.

I work from home and I have Office 2013 installed on one of my PC''s. The office uses Microsoft 365 (office2013). Problem if I generate an accde from home and run on the office PC I get the message this program was developed in a later version of Access. I then have to recompile (accde) on a PC in the office to get it to run, It's no big deal but I would like to know why. Have you any ideas, My office is the professional version. I would have assumed Microsoft 365 would be more current than my copy is a couple of years old

Alan
@Alan,

Glad that it solves your problem cheers!

for your another question... actually I'm not using Microsoft 365 as well as accde file before, so I may not in a good position to answer you this. However... perhaps you can run the following script to test what's the "version" returned from both your home and office's machines, see if the home one is actually higher than the your office one.
debug.print application.Version & " " & application.Build & " " & application.ProductCode

Open in new window

Hope this gives you some clues that you want.
Ryan Chong

Thank you Ryan for all your help and that script

Alan