Improve company productivity with a Business Account.Sign Up

x
?
Solved

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

Posted on 2009-04-13
11
Medium Priority
?
1,067 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
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 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

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
What to do if a split doesn't fit? Or a bunch of invoice lines must be rounded while the sum must match a total? It takes a little, but - when done - it is extremely easy to implement.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…

606 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