Solved

ACCESS 2007 - FOLLOW HYPERLINK PROPERTY - MAKING WORD 2007 THE ACTIVE DOCUMENT

Posted on 2009-04-13
11
1,013 Views
Last Modified: 2013-11-28
I coded hyperlinks to display on an Access 2007 report.  The report lists sequential file identifiers assigned to Word documents. Each file identifier listed in the report is hyperlinked.

By clicking on a hyperlink, the user is taken to the desired Word document.

I wrote the following code to achieve this effect:

Private Sub fldNAME_Click()
Dim strInput As String
strInput = "Y:\SERVERPATH\" & fldNAME & ".doc"
Application.FollowHyperlink strInput, _
NewWindow:=True, AddHistory:=True
End Sub

The links work, and the Word documents open.  Well and good.

The problem is this - once the Word document opens, it immediately minimizes.  That is not good.  I need the Word document to remain the open, visible, and active document until the user decides that she is finished looking at it.

I have tried several different approaches; nothing seems to work.

Thanks for your help.
0
Comment
Question by:AccessHack
  • 7
  • 4
11 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24131019
AccessHack,

1. If you get rid of the NewWindow and AddHistory line, does it work?

2. Consider just opening it using the Shell Command normally without hyperlinking

Something like this:

Dim varApp As Variant
varApp = Shell("C:\Program Files\Microsoft Office\Office12\WINWORD.EXE c:\YourWordFile.doc", vbNormalFocus)

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24131428
FWIW,

I use Access 2007 and when I insert a hyperlink to a Word Document, it always opens Full Screen (Maximized)

JeffCoachman
0
 

Author Comment

by:AccessHack
ID: 24131484

boag2000,

Thanks for your input.  

1.  Deleting the NewWindow and AddHistory line of code did not change the outcome.  

2.  In other contexts, I have seen the Shell Function suggested as an option.  II will study it.  I wonder if that will work here, because the underlying data is dynamic; namely, the path to each Word document will be slightly different depending on the "fldNAME" that a user selects in the report.

Q. Brown

0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 125 total points
ID: 24131790
I posted a generic example.

Obviously, you can insert your "fldNAME" variable into the code:

Something *roughly* like this:

Dim varApp As Variant
varApp = Shell("C:\Program Files\Microsoft Office\Office12\WINWORD.EXE c:\" & fldNAME & ".doc", vbNormalFocus)

But, again, I am still curious as to why the hyperlink opens the file minimized.

The Shell proposal is really a workaround.
The bottom line is that the Hyperlink should work.

Let's see if another expert can provide more info...

JeffCoachman
0
 

Author Comment

by:AccessHack
ID: 24131859
boag2000,

I hit upon something that appears to work.  I am posting the code here because I have to think my problem is not the first or last struggle with this issue.  

In my Access database, users open the Word documents from the Access report by clicking on a file identifier located in a field that I will call fldNAME.  

I set the properties of fldNAME so that hyperlinks are displayed on the report.  Users are most comfortable with that "look and feel,"  although technically I believe I am not generating hyperlinks using the code below.

Here is the code I added:

Private Sub fldNAME_Click()

'This code adds hyperlinks to fldNAME in the report that point to
'the WORD DOCS, which open in a new window when a link
'is clicked

Dim strInput As String

strInput = "C:\PATH_NAME\" & fldNAME & ".doc"

Set objWord = CreateObject("Word.Application")

    With objWord
        'Make the application visible.
        .Visible = True

        'Open the document.
        .Documents.Open (strInput)
    End With
End Sub

This coding seems to work well.  Thanks very much for your help, Jeff.

Q. Brown
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24132184
OK,

BTW, please do not use ALL CAPS in your post.
1. It is considered SHOUTING, and by association, ...rude.
2. It does absolutely nothing to draw attention to your post.
We are all mature professionals here, and we read questions based on our interest in them, not on attempts to make the question "Stand Out"

Fair enough?
;-)

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24132199
Oh, ...and Welcome to Experts-Exchange.com!

;-)

Jeff
0
 

Author Comment

by:AccessHack
ID: 24132653
Thanks, Jeff.  My apologies for the use of caps.  
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24132925
;-)
0
 

Author Comment

by:AccessHack
ID: 24133305
I wanted to follow up on one thing you noted above.  You wrote:

" . . . I am still curious as to why the hyperlink opens the file minimized."

I researched FollowHyperlink extensively, as well as the various errors I came upon in trying to make FollowHyperlink work for my purposes.

Unfortunately, I could locate no property or method that would directly cause Word to remain the active Window using FollowHyperlink.  I did not find an explanation of the behavior, either.  I, too, remain curious about the reasons for it.

I again thank you very much for your attention to my little puzzle.  I plan to test-drive the Shell Method you suggested; I may decide that I like that better.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24191712
;-)
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need to style Hyperlink using Word Mac 2011 5 29
Remove all hidden metadata properties of MS .Docx Files 7 37
Run SQL Server Proc from Access 11 29
Switch 4 11
Introduction This tutorial provides instructions on how to properly format your Word document using the inbuilt tools provided. The benefits of using these tools means your documents are more accessible and easily portable to other applications an…
I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question