Inserting a Spreadsheet into a VBA form control...

Status
Not open for further replies.

pellacad

New Member
Joined
Apr 21, 2002
Messages
9
I need to insert an Excel spreadsheet into a VBA form control...my users will make changes to the data in the spreadsheet and then save the file when they are done.

The name of my spreadsheet form control is "Spreadsheet1"...how would I load my Excel file "XYZ.xls" into this control?

I use the following code to load a spreadsheet into Excel, but I want to load and display an Excel file in a VBA form via the spreadsheet control...

This is my code I use to load a spreadsheet into Excel...

Public xlapp As excel.Application
Public xlbook As excel.Workbook
Public xlbookyesno As String
Public xlfilename As String
Public xlSheet As excel.Worksheet

Set xlapp = CreateObject("Excel.Application")
If xlbookyesno = "yes" Then
Set xlapp = xlbook.Parent
Set xlSheet = xlbook.Sheets("KeyNoteList")
MainEditor.BuildCustomList.Caption = Mid(xlfilename, 1, Len(xlfilename) - 4)
Else
End If

Thank you for your help!

Pete
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Status
Not open for further replies.

Forum statistics

Threads
1,214,875
Messages
6,122,042
Members
449,063
Latest member
ak94

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