Results 1 to 2 of 2

pathway reference to file givs out of range errormsg (pathway is set as variable)

Threaded View

  1. #1
    Registered User
    Join Date
    08-15-2014
    Location
    Slovakia
    MS-Off Ver
    7
    Posts
    6

    pathway reference to file givs out of range errormsg (pathway is set as variable)

    Hello,

    I have a small problem when reffering to excel file in VBA code with its location on the disc. Basically I have a textbox in userform, where I paste path to particular exce file and I need to display the sheets name in ListBox.
    This is the beggining o the code...

    Private Sub TextBox1_Change()
    Dim zosit As String
    zosit = Sheets("druhy").Range("A1").Value
    Sheets("druhy").Range("A1") = TextBox1.Text
    End Sub
    The problems appears to be in third line of this part, sice apparently, when trying to use variable "zosit" it will not locate the file...

    Private Sub CommandButton1_Click()
    Dim N As Long
    With Workbooks.Open(fileName:="zosit")
    For N = 1 To ActiveWorkbook.Sheets.Count
    ListBox1.AddItem ActiveWorkbook.Sheets(N).Name
    Next N
    End With
    End Sub

    Thank you for your help...
    Last edited by phila7475; 08-20-2014 at 05:18 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Skip Manual Selection of Pathway to Reference Workbook
    By SteVo556 in forum Excel General
    Replies: 1
    Last Post: 01-03-2014, 11:21 PM
  2. Redirecting Pathway in Macro
    By Zan03 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-23-2010, 06:50 PM
  3. Changing Pathway in macro
    By Zan03 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-22-2010, 05:11 PM
  4. [SOLVED] CAN YOU CREATE A PATHWAY OF CELLS LIKE A PROGRAM
    By Dean Costa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-28-2006, 05:35 PM
  5. Vlookup Pathway
    By Daffy Duck in forum Excel General
    Replies: 5
    Last Post: 06-16-2005, 04:05 PM

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