PC Review


Reply
Thread Tools Rate Thread

Calculation issue

 
 
Brad
Guest
Posts: n/a
 
      3rd Nov 2008
Using Excel 2007

I have two macros: one that gets data from an external source and the other
that takes information from excel and creates PDF's. If I run each macro
individually, I get the right results. If I call the macro that creates the
PDF's from the macro that gets the data (the pdf's have not been updated with
the new information). The workbook is on automatic calculation mode.

I've have tried adding the lines
Application.Calculatefull
Application.Wait Now + timevalue("00:00:03")

in the first macro before calling the second macro - (with no success) any
suggestions?
 
Reply With Quote
 
 
 
 
Alan Moseley
Guest
Posts: n/a
 
      3rd Nov 2008
Try switching off Auto Calculation and calculating them in the order that you
want them done, for example:-

Public Sub MyCalculate()
Dim sh As Worksheet
Application.Calculation = xlCalculationManual
For Each sh In Workbooks("SourceData").Worksheets
sh.Calculate
Next sh
For Each sh In Workbooks("PDFData").Worksheets
sh.Calculate
Next sh
Application.Calculation = xlCalculationAutomatic
End Sub

--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"Brad" wrote:

> Using Excel 2007
>
> I have two macros: one that gets data from an external source and the other
> that takes information from excel and creates PDF's. If I run each macro
> individually, I get the right results. If I call the macro that creates the
> PDF's from the macro that gets the data (the pdf's have not been updated with
> the new information). The workbook is on automatic calculation mode.
>
> I've have tried adding the lines
> Application.Calculatefull
> Application.Wait Now + timevalue("00:00:03")
>
> in the first macro before calling the second macro - (with no success) any
> suggestions?

 
Reply With Quote
 
Gary''s Student
Guest
Posts: n/a
 
      3rd Nov 2008
Just to be sure that the application responds to the CalculateFull, try
inserting a
DoEvents
immediately following the Application.CalculateFull
--
Gary''s Student - gsnu200811


"Brad" wrote:

> Using Excel 2007
>
> I have two macros: one that gets data from an external source and the other
> that takes information from excel and creates PDF's. If I run each macro
> individually, I get the right results. If I call the macro that creates the
> PDF's from the macro that gets the data (the pdf's have not been updated with
> the new information). The workbook is on automatic calculation mode.
>
> I've have tried adding the lines
> Application.Calculatefull
> Application.Wait Now + timevalue("00:00:03")
>
> in the first macro before calling the second macro - (with no success) any
> suggestions?

 
Reply With Quote
 
Brad
Guest
Posts: n/a
 
      3rd Nov 2008
I found out that I needed to change

..BackgroundQuery = True
..BackgroundQuery = False

To make it work....

One day, thanks for your help.
--
Wag more, bark less


"Gary''s Student" wrote:

> Just to be sure that the application responds to the CalculateFull, try
> inserting a
> DoEvents
> immediately following the Application.CalculateFull
> --
> Gary''s Student - gsnu200811
>
>
> "Brad" wrote:
>
> > Using Excel 2007
> >
> > I have two macros: one that gets data from an external source and the other
> > that takes information from excel and creates PDF's. If I run each macro
> > individually, I get the right results. If I call the macro that creates the
> > PDF's from the macro that gets the data (the pdf's have not been updated with
> > the new information). The workbook is on automatic calculation mode.
> >
> > I've have tried adding the lines
> > Application.Calculatefull
> > Application.Wait Now + timevalue("00:00:03")
> >
> > in the first macro before calling the second macro - (with no success) any
> > suggestions?

 
Reply With Quote
 
Brad
Guest
Posts: n/a
 
      3rd Nov 2008
Tried your method and it didn't work, found out that changing the following
..BackgroundQuery = True
to
..BackgroundQuery = False

Worked....

One day I'll get it, thanks for your help.
--
Wag more, bark less


--
Wag more, bark less


"Alan Moseley" wrote:

> Try switching off Auto Calculation and calculating them in the order that you
> want them done, for example:-
>
> Public Sub MyCalculate()
> Dim sh As Worksheet
> Application.Calculation = xlCalculationManual
> For Each sh In Workbooks("SourceData").Worksheets
> sh.Calculate
> Next sh
> For Each sh In Workbooks("PDFData").Worksheets
> sh.Calculate
> Next sh
> Application.Calculation = xlCalculationAutomatic
> End Sub
>
> --
> Alan Moseley IT Consultancy
> http://www.amitc.co.uk
>
> If I have solved your problem, please click Yes below. Thanks.
>
>
> "Brad" wrote:
>
> > Using Excel 2007
> >
> > I have two macros: one that gets data from an external source and the other
> > that takes information from excel and creates PDF's. If I run each macro
> > individually, I get the right results. If I call the macro that creates the
> > PDF's from the macro that gets the data (the pdf's have not been updated with
> > the new information). The workbook is on automatic calculation mode.
> >
> > I've have tried adding the lines
> > Application.Calculatefull
> > Application.Wait Now + timevalue("00:00:03")
> >
> > in the first macro before calling the second macro - (with no success) any
> > suggestions?

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Subform calculation issue =?Utf-8?B?U3Byb3dsZXI=?= Microsoft Access Forms 5 3rd Jul 2007 04:58 PM
Record calculation issue =?Utf-8?B?Q2h1Y2sgTmVhbA==?= Microsoft Access Queries 4 28th Mar 2007 04:30 PM
calculation issue? JKC Microsoft Excel Misc 6 21st Mar 2006 01:29 PM
Vlookup Calculation Issue cvolkert Microsoft Excel Worksheet Functions 0 7th Sep 2005 02:28 AM
report calculation issue =?Utf-8?B?c2NyZWVuMjQ1?= Microsoft Access Reports 0 15th Feb 2005 07:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:59 AM.