I am having 2 minor problems, first, I can't open an excel workbook:
oExcel = CreateObject("Excel.Application")
oWorkbook = oExcel.Workbooks.Open("C:\WDPQA.xls")
I have even tried
oWorkbook = oExcel.Application.Workbooks.Open("C:\WDPQA.xls")
The funny thing is I will comment out the oWorkbook code is this will work
oWorkbook = oExcel.Application.Workbooks.Add()
oExcel.Visible = .T.
I can add a new workbook, but can't open an existing one. Yes, I am using a 32-bit MS Excel
Second,
oSheet = oExcel.ActiveSheet
oSheet.Range("B1").Value = "C:\Users\wayne.perkins\Documents\Visual FoxPro Projects\QA\29484Q1.DBF"
sDatabase = "C:\WDPQA.DBF"
sSqlstring = "SELECT COUNT(*) FROM " + sDatabase
oQryTable = oSheet.QueryTables.Add("OLEDB;Provider=VFPOLEDB.1;Data Source=" + sDatabase + ";",oSheet.Range("B2"),sSqlstring)
oQryTable.FieldNames = .F.
oQryTable.RefreshStyle = 0
oQryTable.Refresh = .T.
I get an error on oQryTable.Refresh = .T.
Please help. Thank you.
Wayne
oExcel = CreateObject("Excel.Application")
oWorkbook = oExcel.Workbooks.Open("C:\WDPQA.xls")
I have even tried
oWorkbook = oExcel.Application.Workbooks.Open("C:\WDPQA.xls")
The funny thing is I will comment out the oWorkbook code is this will work
oWorkbook = oExcel.Application.Workbooks.Add()
oExcel.Visible = .T.
I can add a new workbook, but can't open an existing one. Yes, I am using a 32-bit MS Excel
Second,
oSheet = oExcel.ActiveSheet
oSheet.Range("B1").Value = "C:\Users\wayne.perkins\Documents\Visual FoxPro Projects\QA\29484Q1.DBF"
sDatabase = "C:\WDPQA.DBF"
sSqlstring = "SELECT COUNT(*) FROM " + sDatabase
oQryTable = oSheet.QueryTables.Add("OLEDB;Provider=VFPOLEDB.1;Data Source=" + sDatabase + ";",oSheet.Range("B2"),sSqlstring)
oQryTable.FieldNames = .F.
oQryTable.RefreshStyle = 0
oQryTable.Refresh = .T.
I get an error on oQryTable.Refresh = .T.
Please help. Thank you.
Wayne