<form id="hbx9t"></form>

<noframes id="hbx9t">

    <em id="hbx9t"><span id="hbx9t"></span></em>

        <noframes id="hbx9t"><address id="hbx9t"><th id="hbx9t"><progress id="hbx9t"></progress></th></address>
        office交流網--QQ交流群號

        Access培訓群:792054000         Excel免費交流群群:686050929          Outlook交流群:221378704    

        Word交流群:218156588             PPT交流群:324131555

        在access中用代碼打開文本框中超鏈接地址

        2021-04-23 08:00:00
        tmtony
        原創
        15408

        在應用程序中,很多情況下都需要跳轉到網絡地址,比如點開公司主頁

        access中,有很多辦法可以通過點擊來打開對應的地址。比如直接在標簽的超鏈接地址屬性下填入對應的地址。

        也可以用下面幾種vba代碼的方法來打開網址:


        1. 直接使用Access內置命令  FollowHyperlink

         Application.FollowHyperlink "http://www.savenstore.com"

        2. 調用IE打開
         Dim strUrl As String
         Dim objWb as Object
         Set objWb = CreateObject("InternetExplorer.Application")
         objWb.Visible = True
         strUrl = "http://www.savenstore.com"
         objWb.Navigate strUrl

        3. 使用API
        '在模塊中聲明函數
        Public Declare Function ShellExecuteA Lib "shell32.dll" _
                                 (ByVal Hwnd As Long, ByVal lpOperation As String, _
                                 ByVal lpFile As String, ByVal lpParameters As String, _
                               ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

        '調用該函數:
          ShellExecuteA Application.hWndAccessApp, "open", "http://www.savenstore.com", vbNullString, vbNullString, 1


        4. 使用shell命令

        Shell "cmd /c start http://www.savenstore.com", vbHide
        Shell "explorer.exe http://www.savenstore.com", 1
        ShellExecute Me.hWnd, "open", http://www.savenstore.com, "", "", SW_SHOWMAXIMIZED
        
          分享