dbTalk Databases Forums  

Refresh excel spreadsheet from sqlserver

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Refresh excel spreadsheet from sqlserver in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
prathi
 
Posts: n/a

Default Refresh excel spreadsheet from sqlserver - 12-19-2003 , 05:56 PM






Hi,

I am trying to refresh an excel spreadsheet from sqlserver.
1. I have setup the excel spreadsheet with external data source to the sqlserver.
2. I have an active x task as follows
'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************
Function Main()

dim xlapp
dim xlbooks
dim xlsheet
dim SheetName
set xlapp = createobject("Excel.Application")
set xlbooks = getobject("\\marketing_list$\prathi.xls")
SheetName = "sheet1"
set xlsheet = xlbooks.worksheets(Sheetname)
xlbooks.RefreshAll
xlbooks.Save
xlapp.quit

Main = DTSTaskExecResult_Success
End Function

3. I get this message, "This action will cancel a pending refresh data command continue ?" (It is an excel message), when I press continue, the active x script continues. I don't want the excel message to show . What do I need to do so that the excel message does not show up!!

I would really appreciate any help with this.

Thanks Prathi


Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Refresh excel spreadsheet from sqlserver - 12-22-2003 , 02:06 AM






What about

Application.DisplayAlerts=False

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



"prathi" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi,

I am trying to refresh an excel spreadsheet from sqlserver.
1. I have setup the excel spreadsheet with external data source to the
sqlserver.
2. I have an active x task as follows
'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************
Function Main()

dim xlapp
dim xlbooks
dim xlsheet
dim SheetName
set xlapp = createobject("Excel.Application")
set xlbooks = getobject("\\marketing_list$\prathi.xls")
SheetName = "sheet1"
set xlsheet = xlbooks.worksheets(Sheetname)
xlbooks.RefreshAll
xlbooks.Save
xlapp.quit

Main = DTSTaskExecResult_Success
End Function

3. I get this message, "This action will cancel a pending refresh data
command continue ?" (It is an excel message), when I press continue, the
active x script continues. I don't want the excel message to show . What
do I need to do so that the excel message does not show up!!
Quote:
I would really appreciate any help with this.

Thanks Prathi




Reply With Quote
  #3  
Old   
prathi
 
Posts: n/a

Default Re: Refresh excel spreadsheet from sqlserver - 12-26-2003 , 02:06 PM



I tried it but now I have a runtime error. Where do I put
Application.DisplayAlerts=False ? Do I have to put it after

set xlapp = createobject("Excel.Application").

Thanks Prathi

----- Allan Mitchell wrote: -----

What about

Application.DisplayAlerts=False

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



"prathi" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi,
I am trying to refresh an excel spreadsheet from sqlserver.
1. I have setup the excel spreadsheet with external data source to the
sqlserver.
2. I have an active x task as follows
'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************
Function Main()
dim xlapp
dim xlbooks
dim xlsheet
dim SheetName
set xlapp = createobject("Excel.Application")
set xlbooks = getobject("\\marketing_list$\prathi.xls")
SheetName = "sheet1"
set xlsheet = xlbooks.worksheets(Sheetname)
xlbooks.RefreshAll
xlbooks.Save
xlapp.quit
Main = DTSTaskExecResult_Success
End Function
3. I get this message, "This action will cancel a pending refresh data
command continue ?" (It is an excel message), when I press continue, the
active x script continues. I don't want the excel message to show . What
do I need to do so that the excel message does not show up!!
Quote:
I would really appreciate any help with this.
Thanks Prathi


Reply With Quote
  #4  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Refresh excel spreadsheet from sqlserver - 12-26-2003 , 02:16 PM



Yes

xlapp.DisplayAlerts = False

--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"prathi" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
I tried it but now I have a runtime error. Where do I put
Application.DisplayAlerts=False ? Do I have to put it after

set xlapp = createobject("Excel.Application").

Thanks Prathi

----- Allan Mitchell wrote: -----

What about

Application.DisplayAlerts=False

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



"prathi" <anonymous (AT) discussions (DOT) microsoft.com> wrote in message
news:264BF7A9-FAD7-4CCB-ABFC-6C0C20D13529 (AT) microsoft (DOT) com...
Hi,
I am trying to refresh an excel spreadsheet from sqlserver.
1. I have setup the excel spreadsheet with external data source to
the
sqlserver.
2. I have an active x task as follows

'************************************************* *********************
' Visual Basic ActiveX Script

'************************************************* ***********************
Function Main()
dim xlapp
dim xlbooks
dim xlsheet
dim SheetName
set xlapp = createobject("Excel.Application")
set xlbooks = getobject("\\marketing_list$\prathi.xls")
SheetName = "sheet1"
set xlsheet = xlbooks.worksheets(Sheetname)
xlbooks.RefreshAll
xlbooks.Save
xlapp.quit
Main = DTSTaskExecResult_Success
End Function
3. I get this message, "This action will cancel a pending refresh
data
command continue ?" (It is an excel message), when I press continue,
the
active x script continues. I don't want the excel message to show .
What
do I need to do so that the excel message does not show up!!
I would really appreciate any help with this.
Thanks Prathi




Reply With Quote
  #5  
Old   
prathi
 
Posts: n/a

Default Re: Refresh excel spreadsheet from sqlserver - 12-29-2003 , 01:36 PM



I am able to refresh the pivot tables on sheet1 from sqlserver. When I open the excel file, it is hidden. I have to go to windows, unhide and select workbook. How can I unhide the workbook from the activex script ? This is the activex script :

Function Main()

dim xlapp
dim xlbooks
dim xlsheet
dim SheetName
set xlapp = createobject("Excel.Application")
set xlbooks = getobject("\\ausdsps301\pub_trans$\marketing_liist \cra_detail.xls")
SheetName = "sheet1"
set xlsheet = xlbooks.worksheets(Sheetname)
xlbooks.RefreshAll
xlbooks.Save
xlapp.quit

Main = DTSTaskExecResult_Success
End Function

Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.