LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Filling ListBox another excel file

Hello,

I'm preparing a User Form containing List Box that shall be filled with
items taken from another excel file. My macro checks first, if this
source xls file is opened, and if not, it is being opened. However, I
realised, that filling the list box works only when the source file is
already opened. If it is not, and when macro opens it, the list box
stays empty. Do you know how to cope with this? Here is my code: (as
you can see I experimented with 'wait' and 'activate' but it did not
solved the problem).

Set AvailableQuotes = Application.Workbooks("Available quotes.xls")
If AvailableQuotes Is Nothing Then
Application.Workbooks.Open FileAvailableQuotes
End If

'Application.Wait (Now + TimeValue("0:00:05"))
'AvailableQuotes.Activate

Set RangeForex = AvailableQuotes.Worksheets(1).Range("b3")
NumberOfFilesForex = AvailableQuotes.Worksheets(1).Range(Range("b4"),
Range("b4").End(xlDown)).Rows.Count

'MsgBox NumberOfFilesForex

For i = 1 To NumberOfFilesForex
Bond.lboxSpotForexAvailable.AddItem RangeForex.Offset(i, 0).Value
Next i


There is also an interesting thing about 'Activate' command. Without
this command, my macro worked only when it was run from VB editor. If
it was run by from sheet command button, macro did not work. Putting
the Activate command, solved the problem here.

 
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
Filling a listbox HSalim[MVP] Excel Programming 1 October 25th 06 08:37 PM
Filling a listbox whith recordset data LuisM[_2_] Excel Programming 4 July 31st 06 05:02 AM
filling userform listbox simonhall[_4_] Excel Programming 2 June 16th 06 01:43 AM
Filling a listbox with transpose of a range from an excel sheet viswanthank Excel Programming 2 June 9th 05 03:37 PM
Problem with Find filling a listbox vba farmer[_2_] Excel Programming 4 October 12th 04 06:55 PM


All times are GMT +1. The time now is 10:46 PM.

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

About Us

"It's about Microsoft Excel"