J
jj
I have an table in access with embedded excel files
I want to extract them to a folder with automation - the only way I know is
to create af Form, and then automatically open and close the form. In the
on-open event I run the following code:
Dim oXL As Object
'Dim strFileSpec As String
'Activate the embedded document in an instance of Excel
'MyOle is a bound object on the form
Me!MyOle.Action = acOLEActivate
'get hold of the instance - assumes that there is only the one
'Instance of Excel running
Set oXL = GetObject(, "Excel.Application")
'Save the document
If Len(Dir(CurrentProject.Path & strFileSpec & ".xls")) > 0 Then
Kill (CurrentProject.Path & strFileSpec & ".xls")
End If
oXL.Workbooks(1).SaveAs CurrentProject.Path & strFileSpec & ".xls"
'Close it, leaving Excel running ready to process the next record
oXL.Workbooks(1).Close False
'Or close Excel if you are just exporting one document
oXL.Quit
This work - But my Very Big problem is that when it reach: Me!MyOle.Action =
acOLEActivate the Security form from excel opens - because the ole Object
contains macros. And this operation need
a manual handling :-(((( Is there a way that I can avoid that - for example
disable the macros so this will not appear?
Thx
JT
I want to extract them to a folder with automation - the only way I know is
to create af Form, and then automatically open and close the form. In the
on-open event I run the following code:
Dim oXL As Object
'Dim strFileSpec As String
'Activate the embedded document in an instance of Excel
'MyOle is a bound object on the form
Me!MyOle.Action = acOLEActivate
'get hold of the instance - assumes that there is only the one
'Instance of Excel running
Set oXL = GetObject(, "Excel.Application")
'Save the document
If Len(Dir(CurrentProject.Path & strFileSpec & ".xls")) > 0 Then
Kill (CurrentProject.Path & strFileSpec & ".xls")
End If
oXL.Workbooks(1).SaveAs CurrentProject.Path & strFileSpec & ".xls"
'Close it, leaving Excel running ready to process the next record
oXL.Workbooks(1).Close False
'Or close Excel if you are just exporting one document
oXL.Quit
This work - But my Very Big problem is that when it reach: Me!MyOle.Action =
acOLEActivate the Security form from excel opens - because the ole Object
contains macros. And this operation need
a manual handling :-(((( Is there a way that I can avoid that - for example
disable the macros so this will not appear?
Thx
JT