Consulting

Results 1 to 9 of 9

Thread: FollowHyperlink ends up in infinite loop

  1. #1
    VBAX Newbie
    Joined
    Aug 2013
    Posts
    4
    Location

    FollowHyperlink ends up in infinite loop

    Hello Everyone,

    In Access I'm using the FollowHyperlink command to open an Excel file.
    The file opens correctly, but after this Excel seems to get stuck in an infinite loop and I have to use ctrl alt del to force close it.
    Any suggestions on how to fix this problem?

    Private Sub Command27_Click()
    Dim tag As String
    tag = Me.Combo2.Column(1)
    FollowHyperlink "S:\PSM\Veiligheidskleppen\Non-Critical Valves In Progress\" & tag & "\" & tag & ".xls"
    End Sub
    Thanks.

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    The first thing to do is look at the code in the ThisWorkbook Code Page in the Excel File.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    VBAX Newbie
    Joined
    Aug 2013
    Posts
    4
    Location
    It seems that there's no code in ThisWorkBook

    ThisWorkbook.JPG

  4. #4
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Is that the workbook from Me.Combo2.Column(1) ?

    If it is, You will probably have to upload it so we can analyze all the Event triggered code in it and find the pieces that causes another Event that causes the first Event.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  5. #5
    VBAX Newbie
    Joined
    Aug 2013
    Posts
    4
    Location
    Sorry for my ignorance, but Combo2 is on a form in the Access file. After selecting an item in this combo and pushing button Command27, the Excel file belonging to the selected tag is automatically opened. The ThisWorkbook code belongs to the Excel file that is opened by Access.

  6. #6
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    With the Workbook, in the VBA Editor, Menu >> Edit >> Find search the Current Project for; partial word, any case, and look for "Change", "Activate", "Close", "Open", and any other Events you can think of. Those are the subs you need to look at.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  7. #7
    VBAX Newbie
    Joined
    Aug 2013
    Posts
    4
    Location
    I found that a lot of worksheets have a "Change" event. I also found that when I save the Excel file with a worksheet active that does not contain a "Change" event that everything works fine. So, my questions now:

    How can I open the Excel file with a specific worksheet?
    I also saw that Excel opens with the calculation not at full screen. How can I do this?

    Thanks.

  8. #8
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    When a Workbook is saved, Excel saves it's complete State.

    So..., before closing the book, Activate a safe sheet, Maximize the window and Save.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  9. #9
    I have found that using ShellExec work better than FollowHyperlink with most apps. I find iit best to only use Followhyperlink with web pages.

    See: Start an app with ShellExecute


    You may need to use Excel Automation to remote control the app. This gives you a lot of control to maximize the Excel app window, selecting worksheets, etc.

    See:

    http://support.microsoft.com/kb/219151
    Boyd Trimmell aka HiTechCoach
    Microsoft Access MVP -2010-2015

    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •