-
Dec 22nd, 2013, 04:19 PM
#1
Thread Starter
Lively Member
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
Code:
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
-
Dec 23rd, 2013, 05:45 AM
#2
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
pete
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|