Results 1 to 3 of 3
  1. #1
    kevint_cnc is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2012
    Posts
    2

    Reference is not valid FollowHyperlink error

    Hi all, apologies if i have posted in the wrong section or do anything wrong, i'm new to this and don't undestand what code tagging is yet.

    I'm creating a database with an Asset register which gives you a simple route to documents related to these perticular assets. My problem is when linking to Excel files. I use the FollowHyperlink method and reference to a Hyperlink in a row of the table. If this Hyperlink happens to be to an excel file (regardless of version) it generates an error stating "Reference is not valid". The odd thing is that the file opens, but is not maximised on opening. I have searched for weeks for a solution but can only find them for Pivot Table problems in excel.

    My code is simply;

    Private Sub FormName_ObjectName_Click()
    On Error Resume Next
    Application.FollowHyperlink [ColumnName]
    End Sub

    This works fine for any file that isn't an excel file. So my question is, what's missing or what needs changing to prevent the error from appearing. I have tried different compatabilities but have had no luck. I also tried a function called GoHyperlink, but had no luck in Access 2007, i'm not sure if it is only available in 2010.

    Any help would be much appreciated



    Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,619
    Google: vba followhyperlink excel reference is not valid
    I found a clue in http://www.ozgrid.com/forum/showthre...t=22695&page=2

    Use the SubAddress argument of FollowHyperlink, like:
    Application.FollowHyperlink [ColumnName], "A1"

    However, I tried the empty string as criteria as suggested but it did not work.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    kevint_cnc is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2012
    Posts
    2
    Brilliant! That worked a treat, i was sure i had tried it before, but i must have got the SubAddress argument filled in slightly differently. Thanks for that. I will now look for some code that will maximise the window, as it still opens small, but you have solved my problem, thanks alot!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Application.FollowHyperlink throwing Exception
    By Mnelson in forum Programming
    Replies: 4
    Last Post: 03-19-2015, 02:13 PM
  2. Replies: 2
    Last Post: 12-08-2011, 02:27 PM
  3. Error: " is not a valid name
    By tonere in forum Access
    Replies: 4
    Last Post: 06-03-2011, 10:39 AM
  4. Replies: 1
    Last Post: 07-21-2009, 03:01 PM
  5. Set IE window size using followhyperlink
    By AndrewAfresh in forum Access
    Replies: 0
    Last Post: 11-23-2006, 12:22 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums