Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default workbooks.open issue

Hi,

I am writing a macro to open a second workbook (call it B) and copy
the rows to the source workbook (call it A).

Here is the issue I am facing: The macro (in A) is not getting
control after executing the Workbooks.Open command, a code snippet is
shown below.

.....
sSourceFilePath = "C:\Created and Closed Lost.xls"
sSourceFileName = "Created and Closed Lost.xls"

.....

'open the source workbook
Workbooks.Open Filename:=sSourceFilePath, ReadOnly:=True
'Workbooks.Open (sSourceFilePath) 'this has been used and the same
problem occurs.
Windows(sSourceFileName).Activate
......


The macro finds and opens the 'Created and Closed Lost.xls' file [this
is B] correctly, but the macro [in A] never gets control back to
finish the rest of the script, continuing with the
Windows(sSourceFileName).Activate.
But the code works fine in the debugger.

I am using Office XP on MS XP OS with the latest patches.
All work is being done on a local drive in the same directory.

Any ideas?

Thanks very much for your help!

Andrew
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default workbooks.open issue

I figured out the problem. The key command to fire off the macro was
CTRL+SHIRT+C. I switched it to CTRL+b and the macro did not cut off
at the workbook.open. Now all is ok.

Thanks for your help!




"Tom Ogilvy" wrote in message ...
Sounds like an error is occuring in the B workbook and it is terminating
macro execution. Could be in the workbook_open event, but more likely due
to a UDF used in the worksheet.

--
Regards,
Tom Ogilvy

"Andrew" wrote in message
m...
Hi,

I am writing a macro to open a second workbook (call it B) and copy
the rows to the source workbook (call it A).

Here is the issue I am facing: The macro (in A) is not getting
control after executing the Workbooks.Open command, a code snippet is
shown below.

....
sSourceFilePath = "C:\Created and Closed Lost.xls"
sSourceFileName = "Created and Closed Lost.xls"

....

'open the source workbook
Workbooks.Open Filename:=sSourceFilePath, ReadOnly:=True
'Workbooks.Open (sSourceFilePath) 'this has been used and the same
problem occurs.
Windows(sSourceFileName).Activate
.....


The macro finds and opens the 'Created and Closed Lost.xls' file [this
is B] correctly, but the macro [in A] never gets control back to
finish the rest of the script, continuing with the
Windows(sSourceFileName).Activate.
But the code works fine in the debugger.

I am using Office XP on MS XP OS with the latest patches.
All work is being done on a local drive in the same directory.

Any ideas?

Thanks very much for your help!

Andrew

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
2 workbooks open Meg Excel Discussion (Misc queries) 3 December 16th 09 06:39 PM
when i open an Excell file 3 workbooks open.Why? Iain40 Excel Discussion (Misc queries) 2 February 3rd 09 05:04 PM
Strange named range issue with multiple workbooks Adam White Excel Discussion (Misc queries) 0 November 14th 06 02:34 AM
When I open Excel, workbooks open automatically. How can I stop t Rhealbird Excel Discussion (Misc queries) 2 February 23rd 06 10:08 AM
Workbooks.Open / .Open Text - How do you stop the .xls addition? Dave[_20_] Excel Programming 2 July 31st 03 04:03 AM


All times are GMT +1. The time now is 04:19 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"