Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xla files with Excel

Status
Not open for further replies.

GSMike

Programmer
Feb 7, 2001
143
US
Is it possible to have a spreadsheet in an xla file, and make reference to data on the spreadsheet in your code?
I am using an xla to distribute an application, and some of the forms have combo boxes. The rowsource property is being set to a column of data which (I thought) was stored with the xla.
The method I used:
1) Opened a new workbook ("book1").
2) Went to the VBA editor and started creating my application.
3) Populated some data on one of the sheets in the workbook, and used that data as the row source property for some combo boxes on forms.
4) Saved the workbook as an "xla" file.
Everything was working fine until I closed the file and reopened it. Now I get an error that indicates that the RowSource property of my combo box is invalid, apparently because the worksheet doesn't really exist (even though it shows up in the project explorer as a worksheet).
So, I am confused.
Any suggestions?
Thanking you in advance.
-Mike Mike Kemp
michael.kemp@gs.com
 
Sub AutomateXLA()
Dim xlApp As Excel.Application

' Create new hidden instance of Excel.
Set xlApp = New Excel.Application
' Show this instance of Excel.
xlApp.Visible = True
Stop ' Press F8 to continue stepping through code.
With xlApp
' Code to automate Excel here.
End With
xlApp.Quit
Set xlApp = Nothing
End Sub Best Regards

---
JoaoTL
NOSPAM_mail@jtl.co.pt
 
Thanks, JoaoTL!!
I appreciate your response.
However, I don't really understand it.
My question about that is, are you talking about an "xla" file here? I'm new to programming Excel, but it seems to me that what you are talking about is opening an xls file and automating that.
I mean, the xla in question, in my situation is open, becaue I see it in the Project Explorer. However, when I go to Excel and select Window > Unhide from the menu bar, all I see to unhide is Persoanl.xls. That's what makes me think that the xla file can't really contain populated spreadsheets, just spreadsheets with code associated with them.
Hope this is making sense to you.
-Mike Mike Kemp
michael.kemp@gs.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top