Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET Database and Reporting > WebQuery Refresh (necessary LogIN)


Reply
 
Thread Tools Display Modes
  #1  
Old 02-16-2011, 06:09 AM
satanovsyn satanovsyn is offline
Newcomer
 
Join Date: Feb 2011
Posts: 2
Unhappy WebQuery Refresh (necessary LogIN)


Hi, I need refresh query table, for which I need to be logged in.
But If I open excel through this:

Code:
oApp.Workbooks.Open("C:\Documents and Settings\hanzal\Desktop\test1.xls")
I need Edit query and Logging it.

My complet code is here:
Code:
Imports Excel
Imports System
Imports System.Linq.Queryable
Imports System.Windows.Forms
Imports Microsoft.Office


Public Class Form1

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim oApp As Object
        Dim excelTable As New DataTable
        oApp = CreateObject("Excel.Application")
        oApp.Visible = True
        oApp.Workbooks.Open("C:\Documents and Settings\hanzal\Desktop\test1.xls")
        oApp.Range("A1").QueryTable.Refresh(BackgroundQuery:=False)


End Sub
End Class
Error: (because I think I am not logged IN)

Code:
System.Runtime.InteropServices.COMException was unhandled
  ErrorCode=-2146827284
  Message=Exception from HRESULT: 0x800A03EC

I need code, for calling VBA from excel or directly connecting with Logind and Password. Without this I can not make a refresh.

Please help.
Reply With Quote
  #2  
Old 02-21-2011, 06:55 AM
satanovsyn satanovsyn is offline
Newcomer
 
Join Date: Feb 2011
Posts: 2
Default

Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

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

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->