ktwk
12-28-2006, 03:56 AM
hi all experts and grandmasters,
i have bind an Ms excel 11.0 object to my form, for those who have downloaded my file (topic: subscript out of range) should have seen it, now i face another problem :), i have a textbox and a command button in "Form A", when i enter an Ms Excel file name to the textbox box and click the command button , "Form B" will appear, now, my ms excel 11.0 object( let's name it Spreadsheet0) is in my "Form B". I need whatever i have in my the Excel file to show in the ms excel 11.0 object.
here is the code
Dim excelWorkbook As Excel.Workbook
If IsNull(Me.Text0) Then
MsgBox "Please key in the exact file name, thank you", vbOKOnly
Else
Set excelWorkbook = GetObject("C:\" & Me.Text0 & ".xls")
excelWorkbook.Application.Visible = True excelWorkbook.Application.Windows("" & Me.Text0 & ".xls").Visible = True
stDocName = "CodeList"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
notice that i didn't close or save the automation object, i will leave it to another button to do it, my situation right now is i am able to execute the file i want, but it does not appear in my object(in the form), the code open the file for me, that all. i know the code above is mean to open the file i want,what i need some hints what to do next, thanks a lot
KT
i have bind an Ms excel 11.0 object to my form, for those who have downloaded my file (topic: subscript out of range) should have seen it, now i face another problem :), i have a textbox and a command button in "Form A", when i enter an Ms Excel file name to the textbox box and click the command button , "Form B" will appear, now, my ms excel 11.0 object( let's name it Spreadsheet0) is in my "Form B". I need whatever i have in my the Excel file to show in the ms excel 11.0 object.
here is the code
Dim excelWorkbook As Excel.Workbook
If IsNull(Me.Text0) Then
MsgBox "Please key in the exact file name, thank you", vbOKOnly
Else
Set excelWorkbook = GetObject("C:\" & Me.Text0 & ".xls")
excelWorkbook.Application.Visible = True excelWorkbook.Application.Windows("" & Me.Text0 & ".xls").Visible = True
stDocName = "CodeList"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
notice that i didn't close or save the automation object, i will leave it to another button to do it, my situation right now is i am able to execute the file i want, but it does not appear in my object(in the form), the code open the file for me, that all. i know the code above is mean to open the file i want,what i need some hints what to do next, thanks a lot
KT