Connecting Tech Pros Worldwide Help | Site Map

How to write by VBA in an embedded xls-file?

  #1  
Old November 13th, 2005, 12:36 PM
veens-zevenhonderdvijf
Guest
 
Posts: n/a
Hi,

I want to show an excel-graphs in one of my access-forms.
The problem is how to refer to an embedded excel-file in my form.
I can refer to an external excelfile (see below) an do some test stuff
in this file but how can I do the same thing in an embedded Xls-file
like "Forms![frmTestForm]![OLEUnbound77]" ?

'open the workbook
Workbooks.Open filename:="C:\Test stuff\temp.xls"
'select sheet "Data"
ActiveWorkbook.Sheets("Data").select
'select whole sheet
Cells.select
'Clear the sheet

Selection.ClearContents
'For example, write "testing" in cell A1
Range("A1")= "testing"
'Save the workbook
ActiveWorkbook.Save
'and exit
ActiveWorkbook.Close

Replies please in this newsgroup
If you want to mail me:
Replace the nul in the adress by a zero.
  #2  
Old November 13th, 2005, 12:38 PM
Bas Cost Budde
Guest
 
Posts: n/a

re: How to write by VBA in an embedded xls-file?


Ik wilde je er net op wijzen dat nul in het Engels zero is... eerst kijken!

How about using Microsoft Graph, available in reports for Access? Ah,
you ask for form functionality.

Apart from answers you get here, try an Excel group as well (don't
mention Access there ;-) )
You want to control Excel through its own VBA dialact, I am afraid.

veens-zevenhonderdvijf wrote:
[color=blue]
> Hi,
>
> I want to show an excel-graphs in one of my access-forms.
> The problem is how to refer to an embedded excel-file in my form.
> I can refer to an external excelfile (see below) an do some test stuff
> in this file but how can I do the same thing in an embedded Xls-file
> like "Forms![frmTestForm]![OLEUnbound77]" ?
>
> 'open the workbook
> Workbooks.Open filename:="C:\Test stuff\temp.xls"
> 'select sheet "Data"
> ActiveWorkbook.Sheets("Data").select
> 'select whole sheet
> Cells.select
> 'Clear the sheet
> Selection.ClearContents
> 'For example, write "testing" in cell A1
> Range("A1")= "testing"
> 'Save the workbook
> ActiveWorkbook.Save
> 'and exit
> ActiveWorkbook.Close
>
> Replies please in this newsgroup
> If you want to mail me:
> Replace the nul in the adress by a zero.[/color]

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
For human replies, replace the queue with a tea

Closed Thread