Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel 2003 from Access 2007

Status
Not open for further replies.

liquidt007

Programmer
Aug 19, 2010
5
US
I have Office 2003 and 2007 on my work computer. I use 2007 for just about everything, but I need to open Excel 2003 from Access 2007. When I put the following code:

Dim xlapp As Excel.Application
Set xlapp = New Excel.Application
xlapp.visible = True

I naturally get Excel 2007. For reasons I won't go into, I need to specifically use 2003. I tried changing the Type Library from Microsoft Excel 12.0 to 11.0, but had no luck with that. Any suggestions are very much appreciated.
 



You need to do what: OPEN & SAVE an Excel 2003 workbook? Yes! Check out the Compatablilty mode.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thank you for your advice. However, I do not need to save a workbook in 2003 format. I actually need to open Excel 2003 and run some macros that are in the workbook. These macros will not run in 2007 and I need to use 2003. Any further advice would be appreciated.
 

These macros will not run in 2007 ...
WHY?

Please explain and post your code, noting any error message/statement.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
There aren't any errors. My company has installed 2007 and restricted the ability to Programatically access VBA project. This option is/was available in 2003. The programs I have written in VBA require programatic access, and it is still available in 2003 which happens to still be on the computer. So I want to be able to run 2003 from the current install of 2007.
 
It sounds like your company might frown on what you are tying however this may do it.

Arange to have Excel 2003 running (possibly by shelling it's exe file) before the following code is run;

Dim ObjXl as Object

Set objXl = GetObject(, "Excel.Application")

With objXl
'do stuff

End with
 
Thanks for the help Skip and Hugh. I'm beginning to get a workaround going here. The shelling and GetObject seems to be the way to go. One little hitch that I'm hung up on though. Previously, my program would include:

xlApp.DisplayAlerts = False
Set wkbk= xlapp.Workbooks.Open(Environ("userprofile") & "\Desktop\XXXX.xls")
xlapp.Run "MyMacro", False

The DisplayAlerts = False allowed the Enable Macros warning to be bypassed and let me run the macro in the workbook by code. By shelling Excel and then opening the workbook, I get the Enable Macros warning now. The ability to lower macro security settings any lower than medium is disabled in the registry by my company, so that option is out.

I'm looking at API calls to try and send a button click to the warning, but haven't quite got it coded yet. Any other suggestions would be much appreciated. Thanks again.
 
Thanks for the help guys. Got it figured out now. It wasn't
DisplayAlerts = False
that I needed. It was
xlapp.AutomationSecurity = msoAutomationSecurityLow
Thanks again for the help. I think things are just about up and running now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top