Michael
Wed Jan 26 18:56:52 CST 2005
wolfing1@yahoo.com wrote:
> 'After doing:
> 'Set objExcel = CreateObject("Excel.Application")
> 'Set abook = objExcel.Workbooks.Open(NameFile)" earlier in the program
>
> 'The following line gives me an error at runtime:
> Set xlmodule = abook.VBProject.VBComponents.Add(1)
>
> Does anyone have any idea why and how that line could give me an error
> 57: Device I/O error ???
When I try something similar (Excel 2003), I get
C:\Scripts\junk.vbs(5, 1) Microsoft Office Excel: Programmatic access to
Visual Basic Project is not trusted
The fix is detailed at:
PRB: Programmatic Access to Office XP VBA Project Is Denied
http://support.microsoft.com/kb/q282830/
--
Michael Harris
Microsoft MVP Scripting