Results 1 to 2 of 2

macro to include cell contents b1 in file path

Threaded View

  1. #1
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    macro to include cell contents b1 in file path

    im trying to answer another thread and this macro does the trick but to make it easier for user id like them to be able to enter filename in say b1 and it gets added to the filepath
    C:\Documents and Settings\Martin Wilson\My Documents\test stuff\filename from b1
    Sub csvtorows()
    
      
    Dim i
      
    Dim sTemp As String
      
    i = FreeFile
      
    Open "C:\Documents and Settings\Martin Wilson\My Documents\test stuff\testcsv.txt" For Input As #i
      
    n = 0
      
    Do While Not EOF(i)
      
    Input #i, sTemp
      
    ActiveCell.Offset(n, 0) = sTemp
      
    n = n + 1
      
    Loop
      
    Close #i
      
    End Sub
    other post is here http://www.excelforum.com/showthread...82#post1951782
    even better would be a user form that pops up prompting for file name when macro run
    pretty please

    EDIT: We are having trouble with the board at the moment so i have had to reply in your post but how about this?
    Dim i
    i = InputBox("Enter File Name", "File Opener")
    Workbooks.Open ("C:\Documents and Settings\Martin Wilson\My Documents\test stuff\" & i & ".xls")
    Last edited by Simon Lloyd; 08-03-2008 at 12:44 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1