Solved

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

Posted on 2009-04-13
11
1,005 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
Comment Utility
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
Comment Utility
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
Comment Utility

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
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 125 total points
Comment Utility
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
Comment Utility
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
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
Comment Utility
Oh, ...and Welcome to Experts-Exchange.com!

;-)

Jeff
0
 

Author Comment

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

Expert Comment

by:Jeffrey Coachman
Comment Utility
;-)
0
 

Author Comment

by:AccessHack
Comment Utility
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
Comment Utility
;-)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
This article describes how to use the Send to Mail Recipient command. The instructions apply generally to Office 2007 and later versions, but Microsoft® Word 2013 was used for the specific steps and figures.  What is Send to Mail Recipient? Send…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

762 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now