Results 1 to 2 of 2

Thread: how to open a word file from a URL

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2009

    Question how to open a word file from a URL

    Hi everybody
    How can I open a word file from a given url directly
    can I make some changes for code below to do that
    Private Sub Button1_Click(sender As Object, e As RibbonControlEventArgs) Handles Button1.Click
            '  PictureBox1.Image = webDownloadword("http://www.somewebsite.com/image.jpg", True, "C:\temp.jpg")
        End Sub
        Public Function webDownloadword(ByVal Url As String, Optional ByVal saveFile As Boolean = False, Optional ByVal location As String = "C:\") As Image
            Dim webClient As New System.Net.WebClient
            Dim bytes() As Byte = webClient.DownloadData(Url)
            Dim stream As New IO.MemoryStream(bytes)
            If saveFile Then My.Computer.FileSystem.WriteAllBytes(location, bytes, False)
            Return New System.Drawing.Bitmap(stream)
        End Function
    Thank you

  2. #2
    Join Date
    Dec 2004

    Re: how to open a word file from a URL

    try API method shellexecute "open", url
    should open any doc type file in default application, normally word if installed
    plenty of examples in this forum
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed

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


Click Here to Expand Forum to Full Width