LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default vba code does not run

Hi All,
I have this vba code in an Access2003 application and the line

.ActiveWorkbook.RefreshAll

does not work 100% of the time and I don't know why. Everything else
works cell A3 gets updated and the workbook gets saved in it's proper
place. Each workbook has a query in this Access db that is the
workbooks data source. If I open each workbook and do a 'RefreshAll'
it works every time without any problems. Defeats automation if I
have
to open each workbook(currently there are 35 different workbooks in
this loop) and check it be sure that the data did refresh.
So, any ideas or insights as to why the 'RefreshAll' when sent from
Access vba does/would not work 100% of the time.......

I know this is Access vba and I have posted this in the Access forum
But I'm looking for any ideas or insight from an Excel perspective as
to why the Excel workbook would not refresh.

Do Until MyRec.EOF
With objExcel
.Visible = False
.DisplayAlerts = False
.Workbooks.Open strOPathNme & strOFileNme
.Range("A3").Select
.ActiveCell.FormulaR1C1 = strLongNmeDte & ", " &
Left(Me.bxMthFor, 4)
.ActiveWorkbook.RefreshAll
.ActiveWorkbook.SaveAs FileName:=strSPathNme & strSFileNme
.ActiveWorkbook.Close savechanges:=False 'this is the
template
file so don't save the changes
.Workbooks.Close
DoEvents
End With
MyRec.MoveNext
 
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
Creating excel file, adding code to it from code, VBE window stays BlueWolverine Excel Programming 0 November 5th 09 07:55 PM
How can I modify my code to offset the defined range and repeat theprocedure instead of duplicating my code? [email protected] Excel Programming 4 May 29th 09 10:13 PM
Run VBA code only worksheet change, but don't trigger worksheet_change event based on what the code does ker_01 Excel Programming 6 October 3rd 08 09:45 PM
Protect Sheet with code, but then code will not Paste error. How do i get around this. Please read for explainations.... Corey Excel Programming 4 November 25th 06 04:57 AM
Excel code convert to Access code - Concat & eliminate duplicates italia Excel Programming 1 September 12th 06 12:14 AM


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