Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
aftamath
 
Posts: n/a
Default Worksheet Names (Revised)

I went ahead and included an updated code from a previous post with a comment
line above the problem area. I can't get the code to work. I need it to
populate a combobox list with the sheet names of a specified workbook.

Private Sub ComboBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)

Dim fs, f, f1, s, sf, sh As Worksheet, wbkChart As Workbook
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder("c:\SymmcoPrograms\" & TextBox1.Value & "\" &
ComboBox1.Value)
Set sf = f.Files

If fs.FileExists("c:\SymmcoPrograms\" & TextBox1.Value & "\" &
ComboBox1.Value & "\Charts.xls") = True Then
Set fa = CreateObject("Scripting.filesystemobject")

€˜This section is giving me troubles Type Mismatch
Set wbkChart = fa.getfile("c:\SymmcoPrograms\" & TextBox1.Value &
"\" _
& ComboBox1.Value & "\Charts.xls")

For Each sh In wbkChart
ComboBox12.AddItem sh.Name
Next
End If

For Each f1 In sf
ComboBox2.AddItem f1.Name
ComboBox3.AddItem f1.Name
ComboBox4.AddItem f1.Name
ComboBox5.AddItem f1.Name
ComboBox6.AddItem f1.Name
ComboBox7.AddItem f1.Name
Next

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Worksheet Names (Revised)

You don't say what problem you are getting, but shouldn't you open the
workbook?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"aftamath" wrote in message
...
I went ahead and included an updated code from a previous post with a

comment
line above the problem area. I can't get the code to work. I need it to
populate a combobox list with the sheet names of a specified workbook.

Private Sub ComboBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)

Dim fs, f, f1, s, sf, sh As Worksheet, wbkChart As Workbook
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder("c:\SymmcoPrograms\" & TextBox1.Value & "\" &
ComboBox1.Value)
Set sf = f.Files

If fs.FileExists("c:\SymmcoPrograms\" & TextBox1.Value & "\" &
ComboBox1.Value & "\Charts.xls") = True Then
Set fa = CreateObject("Scripting.filesystemobject")

'This section is giving me troubles Type Mismatch
Set wbkChart = fa.getfile("c:\SymmcoPrograms\" & TextBox1.Value &
"\" _
& ComboBox1.Value & "\Charts.xls")

For Each sh In wbkChart
ComboBox12.AddItem sh.Name
Next
End If

For Each f1 In sf
ComboBox2.AddItem f1.Name
ComboBox3.AddItem f1.Name
ComboBox4.AddItem f1.Name
ComboBox5.AddItem f1.Name
ComboBox6.AddItem f1.Name
ComboBox7.AddItem f1.Name
Next

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.misc
aftamath
 
Posts: n/a
Default Worksheet Names (Revised)

The problem is a coding error "Type Mismatch". I currently have similar code
working in the same Userform which populates combobox lists by looking up
what files are in certain folders. And the same, what folders are in the
folders above that in another combobox. I'm having trouble with doing the
same for names of worksheets in a specified workbook file. But nothing has
to be opened.

"Bob Phillips" wrote:

You don't say what problem you are getting, but shouldn't you open the
workbook?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"aftamath" wrote in message
...
I went ahead and included an updated code from a previous post with a

comment
line above the problem area. I can't get the code to work. I need it to
populate a combobox list with the sheet names of a specified workbook.

Private Sub ComboBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)

Dim fs, f, f1, s, sf, sh As Worksheet, wbkChart As Workbook
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder("c:\SymmcoPrograms\" & TextBox1.Value & "\" &
ComboBox1.Value)
Set sf = f.Files

If fs.FileExists("c:\SymmcoPrograms\" & TextBox1.Value & "\" &
ComboBox1.Value & "\Charts.xls") = True Then
Set fa = CreateObject("Scripting.filesystemobject")

'This section is giving me troubles Type Mismatch
Set wbkChart = fa.getfile("c:\SymmcoPrograms\" & TextBox1.Value &
"\" _
& ComboBox1.Value & "\Charts.xls")

For Each sh In wbkChart
ComboBox12.AddItem sh.Name
Next
End If

For Each f1 In sf
ComboBox2.AddItem f1.Name
ComboBox3.AddItem f1.Name
ComboBox4.AddItem f1.Name
ComboBox5.AddItem f1.Name
ComboBox6.AddItem f1.Name
ComboBox7.AddItem f1.Name
Next

End Sub




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automating Worksheet Names Tenaj Excel Worksheet Functions 16 January 13th 08 03:13 PM
Lookups using worksheet names Soapydux Excel Discussion (Misc queries) 3 November 6th 05 04:17 PM
Dynamic Worksheet Names £ukasz Czech Links and Linking in Excel 1 August 15th 05 09:41 PM
Defining non worksheet specific names... Steve Excel Worksheet Functions 0 June 29th 05 05:30 AM
Search/Match between 2 x separate Worksheets and populate result in third worksheet Alan Bartley Excel Discussion (Misc queries) 1 April 11th 05 05:21 AM


All times are GMT +1. The time now is 12:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"