I want to be able to cope a cell out of an excel spreadsheet into the URL window of a browser.
Having trouble making the URL line the target of my paste.
Thanks in advance!
Ray
Printable View
I want to be able to cope a cell out of an excel spreadsheet into the URL window of a browser.
Having trouble making the URL line the target of my paste.
Thanks in advance!
Ray
try using DDE or create your own instance of ie use ShDocVw. or what ever thats called, then just use the navigate method. Will post code if wanted.
The code if you could VERY new to VB, the jump start would be helpful.
My e-mail is [email protected] if that is easier.
thanks,
Ray
OK, do you want me to post the code to access excel too, if so, do all the PC in question have excel installed?
yes all machines have excel installed
yes the code to access excel would be helpful,
thanks so much
Ray
OK, here it is!:)
Add a Referance to the Microsoft Excel Object Library v. (9 for excel 2000, 8 for excel 97, etc.)
and to the Microsoft Internet Conrols (Make sure you add a Referance, not Componet)
Now, change the file path and the cell to what you wantCode:'paste this into a .bas module
Public Sub ExcelToURL()
Dim x As Excel.Application 'excel object
Dim objSheet As Excel.Worksheet 'sheet object
Dim ie As New InternetExplorer 'internet explorer object
Dim strURL As String 'url
Set x = CreateObject("Excel.Application") 'create an invisible instance of excel
Set objSheet = x.Workbooks.Open(App.Path & "\MyXls.xls").ActiveSheet 'your path goes here, open your file
strURL = objSheet.Cells(1, 1).Value 'Cell A1, get right cell's value
x.ActiveWorkbook.Close 'close workbook
x.Quit 'exit excel
Set objSheet = Nothing 'clear memory
Set x = Nothing
ie.Navigate strURL 'goto webpage
ie.Visible = True 'show ie
Set ie = Nothing 'clear memory
End Sub
Code:'to use
Call ExcelToURL