Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 10th, 2006, 07:53 AM
Authorized User
 
Join Date: Apr 2006
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default Refresh worksheet on open

Hi all,

What is the code to refresh a worksheet which is linked to a database.
I have searched the internet but I can't find it.

code is written in Cognosscripteditor.

sub main()

dim prompt as long


prompt = 200503


Dim objExcelApp As Object
Set objExcelApp = CreateObject("Excel.Application")

objExcelApp.Workbooks.Open "M:\OPS_Processes\Reports\Status Codes\status update.xls"

'objExcelApp.ActiveWorkbook.sheets("BU").RefreshAl l *** this is not working
' ***** when file status update.xls is openend, then all worksheets needs to be refreshed.

objExcelApp.Visible = true


' ******** removed the database link from the copied file

objExcelApp.ActiveWorkbook.sheets("BU").querytable s(1).delete

objExcelApp.ActiveWorkbook.sheets("Country").query tables(1).delete

objExcelApp.ActiveWorkbook.sheets("Depot").queryta bles(1).delete

objExcelApp.ActiveWorkbook.sheets("Con Details").querytables(1).delete


objExcelApp.ActiveWorkbook.SaveAs "M:\OPS_Processes\Reports\Status Codes\reports\status update " & prompt & " .xls"





Similar Threads
Thread Thread Starter Forum Replies Last Post
Refresh GridView Using Refresh Button msbsam ASP.NET 2.0 Professional 0 December 6th, 2006 05:57 AM
Open up Worksheet alannoble26 Excel VBA 5 February 13th, 2006 02:24 PM
finding a worksheet ozPATT Excel VBA 4 November 16th, 2005 10:54 AM
Send Worksheet alannoble26 Excel VBA 3 November 2nd, 2005 01:04 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.