Notifications
Clear all

botao abre link da internet

3 Posts
2 Usuários
0 Reactions
1,501 Visualizações
(@ericaffj)
Posts: 38
Trusted Member
Topic starter
 

Boa noite
Parece brincadeira mais nao é, procurei na net inteira um simples tutorial que me diga como fazer com que um simples botao no vba abra uma pagina da intenet , algue pode me ajudar?
é simples mesmo botao, o usuario clica nele e abre o google por exemplo..

obrigada...

 
Postado : 07/06/2012 10:03 pm
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Bom dia!!

Veja um exemplo.
Fonte: http://www.vbaexpress.com/kb/getarticle.php?kb_id=905
Irá abrir qualquer arquivo, pasta ou página da web sem o uso de ligação.

Sub OpenFileOrFolderOrWebsite() 
     'Shows how to open files and / or folders and / or websites / or create emails using the FollowHyperlink method
    Dim strXLSFile As String, strPDFFile As String, strFolder As String, strWebsite As String 
    Dim strEmail As String, strSubject As String, strEmailHyperlink As String 
     
    strFolder = "C:Test Files" 
    strXLSFile = strFolder & "Test1.xls" 
    strPDFFile = strFolder & "Test.pdf" 
    strWebsite = "http://www.vbaexpress.com/" 
     
    strEmail = "mailto:YourEmailHere@Website.com" 
    strSubject = "?subject=Test" 
    strEmailHyperlink = strEmail & strSubject 
     
     '***********FEEL FREE TO COMMENT ANY OF THESE TO TEST JUST ONE ITEM***
     'Open Folder
    ActiveWorkbook.FollowHyperlink Address:=strFolder, NewWindow:=True 
     'Open excel workbook
    ActiveWorkbook.FollowHyperlink Address:=strXLSFile, NewWindow:=True 
     'Open PDF file
    ActiveWorkbook.FollowHyperlink Address:=strPDFFile, NewWindow:=True 
     'Open VBAX
    ActiveWorkbook.FollowHyperlink Address:=strWebsite, NewWindow:=True 
     'Create New Email
    ActiveWorkbook.FollowHyperlink Address:=strEmailHyperlink, NewWindow:=True 
     '***************************************************************************
End Sub 
Option Compare Text 
Option Explicit 
 
Sub OpenHTMLpage_SearchIt() 
    Dim Cell As Range, Keyword$, N%, SearchAgain As VbMsgBoxResult 
     'put your own URL below, an example is given
    Application.Workbooks.Open ("http://www.geocities.com/johnske100/TheFINDfunction.html") 
     'the page opens in column A so we need column A fairly wide to read the page
    Columns(1).ColumnWidth = 85 
    MsgBox "When finished - click X on the web window to close it " 
StartSearch: 
    N = 0 
    Keyword = InputBox("Enter the word or phrase you are looking for", "Keyword Is ?") 
    If Keyword = Empty Then Goto StartSearch 
    For Each Cell In Range("A1:A500") 
        If Cell Like "*" & Keyword & "*" Then 
            MsgBox "An " & Keyword & " was found at " & Cell.Address & " (" & Cell & ")" 
            N = N + 1 
        End If 
    Next Cell 
    If N = 0 Then MsgBox "Sorry, no " & Keyword & "'s found", , "not Found" 
    SearchAgain = MsgBox("Another search?", vbYesNo, "More?") 
    If SearchAgain = vbYes Then Goto StartSearch 
End Sub 
 
Postado : 08/06/2012 5:49 am
(@ericaffj)
Posts: 38
Trusted Member
Topic starter
 

E X E L E N T E ...

sem palavras... perfeitoo..
Funciona corretamente todas as funções que nele esta´escritooo..

Muito obrigada..

 
Postado : 08/06/2012 8:04 am