ListBox Display is empty - Help!

Fred2525

New Member
Joined
Jul 15, 2013
Messages
2
I am new to VBA... I have a combo list box that points to another workbook and worksheet. When I manually open the 2nd workbook and worksheet, my listbox works perfectly. Everything is great. However... writing VBA code to open the workbook automatically, the listbox is empty. The workbook is there and I can alt-tab to it, but the listbox does not recognize it. I expected opening a workbook or workbook(s), I would have access to the tabs, (Sheets), without any problems. Can anybody guide me to automatically open a 2nd workbook where the data exists for my listbox?
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Further testing... I open a workbook. Automatically open a 2nd workbook (WBk2), using MsgBox display items from (WBk2). I then Activate the 1st Workbook I opened originally and display items from my original workbook (WBk1). I then attempt to display the details from WBk2 again, but now get a subscript out of range error. (As if the Workbook and Worksheets no longer exist. (But... I can Alt-Tab to both workbooks.) Code..... Sub Auto_Open()
Application.ScreenUpdating = False
ControlFile = ActiveWorkbook.Name
Workbooks.Open Filename:="\\ntserver5\NWI Reports\Departments\Sales\Quotation System\Control\Quote_Control.xlsx"

Msg = "B3: " & Sheets("File_Paths").Range("B3").Value & vbCrLf
Msg = Msg & "C3: " & Sheets("File_Paths").Range("C3").Value & vbCrLf
Msg = Msg & "D3: " & Sheets("File_Paths").Range("D3").Value & vbCrLf
MsgBox Msg

Windows(ControlFile).Activate

Msg = "B3: " & Sheets("Quote_Files").Range("B3").Value & vbCrLf
Msg = Msg & "C3: " & Sheets("Quote_Files").Range("C3").Value & vbCrLf
Msg = Msg & "D3: " & Sheets("Quote_Files").Range("D3").Value & vbCrLf
MsgBox Msg

Msg = "B3: " & Sheets("File_Paths").Range("B3").Value & vbCrLf
Msg = Msg & "C3: " & Sheets("File_Paths").Range("C3").Value & vbCrLf
Msg = Msg & "D3: " & Sheets("File_Paths").Range("D3").Value & vbCrLf
MsgBox Msg
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top