Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Workbooks.add([Template]) Crashing Excel


I write custom reports for my company using excel to pull data out o
access databases. Anyway, the issue I am having is at one of ou
customers it will no longer run the report. After some debugging I hav
found the following error..

Automation Error Remote Procedure Call Failed: #-2147023170

Anyway, it crashes when opening a new session of excel through th
macro
Here is the portion of the code that pertains to the crashing...

Sub OpenTemplate(File_Path as string)
Dim xlApp as excel.application
Dim xlDoc as workbook

set xlApp = CreateObjecT("Excel.Application")
*set xlDoc = xlApp.Workbooks.Add(File_Path)*
This is where it is error out. It runs just fine on my machine and al
of our other customers machines....

They are running Excel 2002; and Microsoft Windows XP.

Does anyone have a clue about why this would fail? The File_Path is th
correct file and I can open it manually. I even did an immediates windo
with just

*Workbooks.Add("c:\backoff\doc1.xls")*

That crashed Excel completely..

--
kralj
-----------------------------------------------------------------------
kraljb's Profile: http://www.excelforum.com/member.php...nfo&userid=995
View this thread: http://www.excelforum.com/showthread.php?threadid=40094

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Workbooks.add([Template]) Crashing Excel

Your code worked ok for me (xl2003 and winXP home).

Does it work ok if you open a different template? Maybe there's something wrong
with that workbook on the troublesome pc??????

And is there a reason to open a new instance of excel? Why not just create the
new workbook in that already running instance?

kraljb wrote:

I write custom reports for my company using excel to pull data out of
access databases. Anyway, the issue I am having is at one of our
customers it will no longer run the report. After some debugging I have
found the following error..

Automation Error Remote Procedure Call Failed: #-2147023170

Anyway, it crashes when opening a new session of excel through the
macro
Here is the portion of the code that pertains to the crashing...

Sub OpenTemplate(File_Path as string)
Dim xlApp as excel.application
Dim xlDoc as workbook

set xlApp = CreateObjecT("Excel.Application")
*set xlDoc = xlApp.Workbooks.Add(File_Path)*
This is where it is error out. It runs just fine on my machine and all
of our other customers machines....

They are running Excel 2002; and Microsoft Windows XP.

Does anyone have a clue about why this would fail? The File_Path is the
correct file and I can open it manually. I even did an immediates window
with just

*Workbooks.Add("c:\backoff\doc1.xls")*

That crashed Excel completely...

--
kraljb
------------------------------------------------------------------------
kraljb's Profile: http://www.excelforum.com/member.php...fo&userid=9955
View this thread: http://www.excelforum.com/showthread...hreadid=400943


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Workbooks.add([Template]) Crashing Excel


Well, it is needed to be opened in a new excel because I am doing this
to replicate what a program that I use does (vb 6 program)...

I can open the workbook just fine outside... and it fails on any excel
document that I try...


--
kraljb
------------------------------------------------------------------------
kraljb's Profile: http://www.excelforum.com/member.php...fo&userid=9955
View this thread: http://www.excelforum.com/showthread...hreadid=400943

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Workbooks.add([Template]) Crashing Excel

I'd add this right after the createobject line:
xlapp.visible = true
to see if that gives you a clue.


kraljb wrote:

Well, it is needed to be opened in a new excel because I am doing this
to replicate what a program that I use does (vb 6 program)...

I can open the workbook just fine outside... and it fails on any excel
document that I try...

--
kraljb
------------------------------------------------------------------------
kraljb's Profile: http://www.excelforum.com/member.php...fo&userid=9955
View this thread: http://www.excelforum.com/showthread...hreadid=400943


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a template option for Workbooks.Add(xlWBATWorksheet)? Hank Scorpio Excel Discussion (Misc queries) 6 August 11th 09 09:37 AM
I want a Master Worksheet that other Workbooks use as a template? coreyb66 Excel Discussion (Misc queries) 3 April 14th 08 12:33 AM
Is there a way to set up a template for new workbooks? Richard Excel Discussion (Misc queries) 6 May 26th 06 04:08 PM
Template changes to existing workbooks farmkid21 Excel Worksheet Functions 2 March 23rd 06 06:51 PM
macro problems with Workbooks.Add Template Philip[_6_] Excel Programming 2 June 23rd 04 05:17 PM


All times are GMT +1. The time now is 12:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"