
02-16-2011, 06:09 AM
|
|
Newcomer
|
|
Join Date: Feb 2011
Posts: 2
|
|
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.
|
|