|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
OLE control using excel
hello,
I am not able to enter value cell by cell in excelsheet by using OLE Control. I have included OLE in the form. From "Inser Object" dialog box I have selected "Microsoft Excel Worksheet". Now I have created one command to execute the process. In the commnd event I have included the following code. OLE1.object.Cells(1, 1).Value = "Sep" OLE1.object.Cells(2, 1).Value = 3 OLE1.object.Cells(3, 1).Value = 4 OLE1.object.Cells(4, 1).Value = 6 But this is not working. Its give me error as "object doesn't support this property or method". Can any one tell me what should be the solution of this problem ? Please provide me some sample examples or links of OLE control by using excel in visual basic. Thnaks, vb_user. |
|
#2
|
|||
|
|||
|
Now,I guess u have a mistake in your code:U wouldn't use ole object,Should use office object(contains excel object).
Plz vist the msdn to get more kownledge.http://msdn.microsoft.com/library/d...objectmodel.asp http://msdn.microsoft.com/library/d...xcelobjects.asp http://www.microsoft.com/officedev/...es/OffObjPr.htm Last edited by cleverpig : October 23rd, 2003 at 09:54 AM. |
|
#3
|
|||
|
|||
|
OLE objects on Access form
Quote:
I'm trying to achive the same goal , but the links are not valid anymore, could someone pelase help me ? Thanks |
|
#4
|
|||
|
|||
|
Code:
Sub Test01()
Dim appXL As Object
On Error GoTo ErrorHandler
Set appXL = GetObject(, "Excel.Application")
ChDir "C:\Documents and Settings\Administrator\Desktop"
appXL.ActiveWorkbook.Sheets("Sheet1").Range("A1").Value = "[test]"
appXL.ActiveWorkbook.Save
appXL.ActiveWorkbook.Close
appXL.Quit
Set appXL = Nothing
Exit Sub
ErrorHandler:
If Err = 429 Then
MsgBox Err
Set appXL = CreateObject("Excel.Application")
appXL.Workbooks.Add
End If
'Resume execution at same line that caused the error:
Resume Next
End Sub
|
|
#5
|
|||
|
|||
|
Thank you for your code,
Is there a way to just have the data on the excel sheet that is added on the access form <OLE object> without saving it anywhere? |
|
#6
|
|||
|
|||
|
Quote:
Please explain what you're trying to do. 1. Is there an environment that you're working inside (here)? Is it Access? 2. From here, is there a place (there) that you're trying to insert data to or extract data from? Is it Excel? 3. The external place (there): Do you want to retrieve data from it, or push data to it? What kind of data is it? |
|
#7
|
|||
|
|||
|
Thank you for your interest in helping me frank !
i have an access form that i placed an excel unbound object (the excel object is not linked to any excel document. im trying to create a process for the user that runs on the access database with a click on a button, the data will be gathered and displayed on the excel sheet, and then some graphs will be generated, the data wont be saved, its just on the fly and the report will then be printed right away, but no data will be saved. i tried the code you provided me, but it opens the MS excel application, and i cant do anything esle while its working, because it takes the focus.. i would like the process to run without having excel application open to the user. thank you Mimi |
|
#8
|
|||
|
|||
|
So you do want to have a Workbook open. Already open? (Whenever your Access routine is run?)
GetObject() gets the object of a pre-opened Excel instance. Excel must already be running. CreateObject() makes a new Excel instance. It will load a new Excel app. into the screen. So, do you want to manually keep track of whether Excel is already onscreen? Do you want it to load automatically if it's not already there? Do you want to keep only one Excel instance in memory (with 1 or more Workbooks inside) at any given time? Quote:
Last edited by Frank20 : April 2nd, 2008 at 09:25 PM. |
|
#9
|
||||
|
||||
|
What is your output in Access? Do you think it's possible to store it in memory. Hold the data in the memory, run an instance of Excel then put it on excel. Im just shooting in the dark here. Might give us more info.
-zyn |
|
#10
|
|||
|
|||
|
Quote:
Do i have to open an instance of the excel object to have my data visibel one the unbound object frame of excel object? I do not want to have excel application open, or if it has to be open, i dont want it to be visible for the user or having the focus. and i would want everything to run (data ) and show (graphs) on the unbound object frame of excel object. |
|
#11
|
|||
|
|||
|
unbound OLE object, please help ?
Quote:
i wouldn't want to use the memory of the pc as i have lots of process running on the same time, and it would make the pc run out of memory as the data handled is big. i work in finance, and i'm trying to generate a report to the user that shows the securities we hold within portfolios and their prices and performance calculations and then on another tab of the unbound frame of excel object, show differnet graphs of performance etc, that would be generated from the data that has been listed on the first tab of the excel sheet. The generated results will then be printed as a report, but will not be saved anywhere. the user would like to have everything on the Database, thats why i cant use exterior excel sheets, or save them anywhere Last edited by mimi_fara : April 4th, 2008 at 08:58 AM. |
|
#12
|
||||
|
||||
|
This is getting complicated with the use of Access and Excel. If you have experience with VBA then you can do it with VB6. Make an app with database then export in excel what you need.
|
|
#13
|
|||
|
|||
|
Hello again !
i have worked on with your code, but i have an issue. i have used the following code : Code:
Dim appXL As Object
Set appXL = GetObject(, "Excel.Application")
Me.excelsheet.Verb = acOLEVerbShow
Me.excelsheet.Action = acOLEActivate
appXL.ActiveWorkbook.Sheets("sheet1").Range("C1") = nav
now, excelsheet is the unbound object frame on my access form. when i use the above code, the excel application opens and the user get to see what is happening when i assign the variable to the range. but, as i dont want the application to be visible to the user i set the me.excelsheet.verb= acOLEVerbHide and when i use this and try to assign the value to the Range C1 i get the error " Run-time error 91: Object variable or with block variable not set" how could i get around this ? Thanks !! Quote:
|
|
#14
|
|||
|
|||
|
If this is some kind of object physically embedded on the Access Form, can you just grab the corners of it in design mode and make it very, very small?
|