Results 1 to 7 of 7

Thread: Pasting into browser

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    4
    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

  2. #2
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    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.
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    4

    Would appreciate

    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

  4. #4
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    OK, do you want me to post the code to access excel too, if so, do all the PC in question have excel installed?
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    4
    yes all machines have excel installed

  6. #6

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    4

    and

    yes the code to access excel would be helpful,
    thanks so much
    Ray

  7. #7
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    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)

    Code:
    '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
    Now, change the file path and the cell to what you want

    Code:
    'to use
    Call ExcelToURL
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

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