Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default external data (detailed)

I'm working in XP trying to get external data from MS Access 2003 into Excel
2003. I would like to have some sort of a pop-up window ask me which database
to get the data from before Excel pulls it in (vice the get external data
menu where you can only choose to pull from one database). I ran the record
new macro and got something about like this for the code to get external data:

With ActiveWorkbook.PivotCaches.Add(SourceType:=xlExter nal)
.Connection = Array (Array ( _
"ODBC;DSN= MS Access Database; DBQ=C:\test\test.mdb;
DefaultDir=C:\test\test.mdb; DriverId=25; FIL=MS Access; MaxBuffer" _
), Array("Size=2048; PageTimeout=5;"))
.CommandType = xlCmdSql
.CommandText = Array( _
"SELECT 'test1'.test1, 'test1'.test2" & Chr(13) & "" & Chr(10)
& "FROM 'C:\test\test'.'test' " _
, "'test'")
.CreatePivotTable TableDestination:=" [Book1]Sheet1!R3C1", TableName:= _
"PivotTable1", DefaultVersion:=xlPivotTableVersion10
End With

I was trying to take this code and do something like:

Sub a()
Dim FName As Variant
FName = Application.GetOpneFileName("Access files (*.mdb),*.mdb")
If FName < False Then
*My Code*
Else
MsgBox "user cancelled"
End If
End Sub


This fails.

Any suggestions/help?

Thanks,
Lou
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 595
Default external data (detailed)

Lou

Make sure this line

"ODBC;DSN= MS Access Database; DBQ=C:\test\test.mdb;

looks like this

"ODBC;DSN=MS Access Database; DBQ=" & Fname & ";"

It should work as long as you have your variable inserted correctly.

--
Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-blog.com


lou sanderson wrote:
I'm working in XP trying to get external data from MS Access 2003
into Excel 2003. I would like to have some sort of a pop-up window
ask me which database to get the data from before Excel pulls it in
(vice the get external data menu where you can only choose to pull
from one database). I ran the record new macro and got something
about like this for the code to get external data:

With ActiveWorkbook.PivotCaches.Add(SourceType:=xlExter nal)
.Connection = Array (Array ( _
"ODBC;DSN= MS Access Database; DBQ=C:\test\test.mdb;
DefaultDir=C:\test\test.mdb; DriverId=25; FIL=MS Access;
MaxBuffer" _ ), Array("Size=2048; PageTimeout=5;"))
.CommandType = xlCmdSql
.CommandText = Array( _
"SELECT 'test1'.test1, 'test1'.test2" & Chr(13) & "" & Chr(10)
& "FROM 'C:\test\test'.'test' " _
, "'test'")
.CreatePivotTable TableDestination:=" [Book1]Sheet1!R3C1",
TableName:= _ "PivotTable1", DefaultVersion:=xlPivotTableVersion10
End With

I was trying to take this code and do something like:

Sub a()
Dim FName As Variant
FName = Application.GetOpneFileName("Access files (*.mdb),*.mdb")
If FName < False Then
*My Code*
Else
MsgBox "user cancelled"
End If
End Sub


This fails.

Any suggestions/help?

Thanks,
Lou



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
External Data Warning Message - I have No External Data in wrkbk Cass_makeitfun[_2_] Excel Discussion (Misc queries) 0 May 12th 10 09:02 PM
Getting Detailed Pivot Results when some row data is identical holmansworld Excel Discussion (Misc queries) 4 February 14th 09 05:49 AM
Use detailed data in one worksheet to create summary data as chart source rdemyan Charts and Charting in Excel 0 January 23rd 07 02:18 PM
Display detailed data in a pop up box North Tim New Users to Excel 3 January 3rd 07 02:03 PM
Data comparison showing detailed output DJSTYLi Excel Programming 1 November 15th 04 03:06 PM


All times are GMT +1. The time now is 08:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"