Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default UserForm problem

Hi

I have a workbook from which I need to open 2 other workbooks seperately and
run the Print_Summary macro from within each. My problem is, each workbook
has a UserForm which loads on open for the benefit of the users of those
workbooks. My code opens the workbook OK, but the UserForm seems to stop the
rest of the code from running since if I close the UserForm manually it
continues to run as I want it to. How do I get around this problem so that
the code runs without being interupted by the UserForm loading?The form is
called frmMenuBrac and
the code I am using:

Sub Print_Budget_ALL()

Application.DisplayAlerts = False
Workbooks.Open Filename:= _
"X:\ACCOUNTS-EAST\New MA Project\Budget\2009\BracBudget.xls",
UpdateLinks:=3
Application.Run "'BracBudget.xls'!Print_Stowmarket_Summary"
Workbooks("BracBudget.xls").Close
Application.DisplayAlerts = True

End Sub

Thanks for your help
Martyn
--
Excel 2000, Windows 2003 over Citrix PS4
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default UserForm problem

Try setting a reference to the workbook you are opening and then unload the
form.

e.g

Sub Print_Budget_ALL()
Dim wbEx as Workbook
Application.DisplayAlerts = False
Set wbEx = Workbooks.Open(Filename:= _
"X:\ACCOUNTS-EAST\New MA Project\Budget\2009\BracBudget.xls", _
UpdateLinks:=3)

Unload frmMenuBrac

End With

Application.Run "'BracBudget.xls'!Print_Stowmarket_Summary"

wbEx.Close SaveChanges:=False
Application.DisplayAlerts = True

End Sub

--

Regards,
Nigel




"WembleyBear" wrote in message
...
Hi

I have a workbook from which I need to open 2 other workbooks seperately
and
run the Print_Summary macro from within each. My problem is, each workbook
has a UserForm which loads on open for the benefit of the users of those
workbooks. My code opens the workbook OK, but the UserForm seems to stop
the
rest of the code from running since if I close the UserForm manually it
continues to run as I want it to. How do I get around this problem so that
the code runs without being interupted by the UserForm loading?The form is
called frmMenuBrac and
the code I am using:

Sub Print_Budget_ALL()

Application.DisplayAlerts = False
Workbooks.Open Filename:= _
"X:\ACCOUNTS-EAST\New MA Project\Budget\2009\BracBudget.xls",
UpdateLinks:=3
Application.Run "'BracBudget.xls'!Print_Stowmarket_Summary"
Workbooks("BracBudget.xls").Close
Application.DisplayAlerts = True

End Sub

Thanks for your help
Martyn
--
Excel 2000, Windows 2003 over Citrix PS4


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default UserForm problem


Hi Nigel

Thanks, I tried this but the form still stops the code after the workbook is
opened to the print macro fails to run. If I close the form manually, I then
get an error on the line Unload frmMenuBrac saying "object required -
frmMenuBrac". I double-checked the name of the object is spelt correctly but
I wonder if this is possibly because I closed the form manually anyway?

Martyn
--
Excel 2000, Windows 2003 over Citrix PS4


"Nigel" wrote:

Try setting a reference to the workbook you are opening and then unload the
form.

e.g

Sub Print_Budget_ALL()
Dim wbEx as Workbook
Application.DisplayAlerts = False
Set wbEx = Workbooks.Open(Filename:= _
"X:\ACCOUNTS-EAST\New MA Project\Budget\2009\BracBudget.xls", _
UpdateLinks:=3)

Unload frmMenuBrac

End With

Application.Run "'BracBudget.xls'!Print_Stowmarket_Summary"

wbEx.Close SaveChanges:=False
Application.DisplayAlerts = True

End Sub

--

Regards,
Nigel




"WembleyBear" wrote in message
...
Hi

I have a workbook from which I need to open 2 other workbooks seperately
and
run the Print_Summary macro from within each. My problem is, each workbook
has a UserForm which loads on open for the benefit of the users of those
workbooks. My code opens the workbook OK, but the UserForm seems to stop
the
rest of the code from running since if I close the UserForm manually it
continues to run as I want it to. How do I get around this problem so that
the code runs without being interupted by the UserForm loading?The form is
called frmMenuBrac and
the code I am using:

Sub Print_Budget_ALL()

Application.DisplayAlerts = False
Workbooks.Open Filename:= _
"X:\ACCOUNTS-EAST\New MA Project\Budget\2009\BracBudget.xls",
UpdateLinks:=3
Application.Run "'BracBudget.xls'!Print_Stowmarket_Summary"
Workbooks("BracBudget.xls").Close
Application.DisplayAlerts = True

End Sub

Thanks for your help
Martyn
--
Excel 2000, Windows 2003 over Citrix PS4



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
Problem with UserForm Bob Excel Programming 5 August 31st 07 02:26 PM
userform problem Brian Matlack[_104_] Excel Programming 5 July 11th 06 09:57 PM
Userform problem racudd Excel Programming 2 April 14th 06 10:30 PM
userform problem Pierre via OfficeKB.com[_2_] Excel Programming 3 October 14th 05 03:08 PM
Userform from a Userform Problem Adrian Excel Programming 1 October 12th 05 04:57 PM


All times are GMT +1. The time now is 12:46 AM.

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

About Us

"It's about Microsoft Excel"