ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Import External Data Wizard (https://www.excelbanter.com/excel-programming/347373-import-external-data-wizard.html)

wgl

Import External Data Wizard
 
I am trying to initiate the Import External Data Wizard using code. I'm using
Excel 2003. I've tried using the following code:
Dim ImportData As CommandBarButton
Set ImportData = CommandBars("Worksheet Menu Bar") _
.Controls("Data").Controls("Import External Data").Controls("Import
&Data...")
ImportData.Execute

The above code results in the following error.
2147467259 - Execute Failed

I also tried to use Application.Dialogs, but I was not able to find the
right dialog.

How can I accomplish this?


sebastienm

Import External Data Wizard
 
Hi,
What about using the built-in Dialogs instead:
Dim v
On Error Resume Next
v = Application.Dialogs(xlDialogImportTextFile).Show()
'check v value if user clikc ok or cancel (cancel- false i believe)

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"wgl" wrote:

I am trying to initiate the Import External Data Wizard using code. I'm using
Excel 2003. I've tried using the following code:
Dim ImportData As CommandBarButton
Set ImportData = CommandBars("Worksheet Menu Bar") _
.Controls("Data").Controls("Import External Data").Controls("Import
&Data...")
ImportData.Execute

The above code results in the following error.
2147467259 - Execute Failed

I also tried to use Application.Dialogs, but I was not able to find the
right dialog.

How can I accomplish this?


wgl

Import External Data Wizard
 
I need to have more options other than text files. The import external data
wizard provides the ability to import data from many different sources.

"sebastienm" wrote:

Hi,
What about using the built-in Dialogs instead:
Dim v
On Error Resume Next
v = Application.Dialogs(xlDialogImportTextFile).Show()
'check v value if user clikc ok or cancel (cancel- false i believe)

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"wgl" wrote:

I am trying to initiate the Import External Data Wizard using code. I'm using
Excel 2003. I've tried using the following code:
Dim ImportData As CommandBarButton
Set ImportData = CommandBars("Worksheet Menu Bar") _
.Controls("Data").Controls("Import External Data").Controls("Import
&Data...")
ImportData.Execute

The above code results in the following error.
2147467259 - Execute Failed

I also tried to use Application.Dialogs, but I was not able to find the
right dialog.

How can I accomplish this?


sebastienm

Import External Data Wizard
 
Concerning the Execute method, i don't know why it doesn't work with this
particular built-in menu item.

Still, using the
Dialogs(...).Show
i would think you could call that particular dialog. In xl2k, you have 3
CommandButtons (New Web Query, New Database uery, and Import Text File). For
web queries it is xlDialogNewWebQuery, for text file it is
xlDialogImportTextFile, but i couldn't find it for database query.
Look in the online help and search 'Built-In Dialog Box Argument Lists';
that's where i found the 2 previous ones.

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"wgl" wrote:

I need to have more options other than text files. The import external data
wizard provides the ability to import data from many different sources.

"sebastienm" wrote:

Hi,
What about using the built-in Dialogs instead:
Dim v
On Error Resume Next
v = Application.Dialogs(xlDialogImportTextFile).Show()
'check v value if user clikc ok or cancel (cancel- false i believe)

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"wgl" wrote:

I am trying to initiate the Import External Data Wizard using code. I'm using
Excel 2003. I've tried using the following code:
Dim ImportData As CommandBarButton
Set ImportData = CommandBars("Worksheet Menu Bar") _
.Controls("Data").Controls("Import External Data").Controls("Import
&Data...")
ImportData.Execute

The above code results in the following error.
2147467259 - Execute Failed

I also tried to use Application.Dialogs, but I was not able to find the
right dialog.

How can I accomplish this?


wgl

Import External Data Wizard
 
Thanks sebastienm for your imput.

I really need to use the Import External Data Wizard, because it has all of
the import options in one place. I'm trying to make the application easy for
the user to use and for it to be self intuitive . If I can't find a way to do
it from code, the users will have to import the data using the menu which
will have to be explained to some users.

Thanks again.

"sebastienm" wrote:

Concerning the Execute method, i don't know why it doesn't work with this
particular built-in menu item.

Still, using the
Dialogs(...).Show
i would think you could call that particular dialog. In xl2k, you have 3
CommandButtons (New Web Query, New Database uery, and Import Text File). For
web queries it is xlDialogNewWebQuery, for text file it is
xlDialogImportTextFile, but i couldn't find it for database query.
Look in the online help and search 'Built-In Dialog Box Argument Lists';
that's where i found the 2 previous ones.

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"wgl" wrote:

I need to have more options other than text files. The import external data
wizard provides the ability to import data from many different sources.

"sebastienm" wrote:

Hi,
What about using the built-in Dialogs instead:
Dim v
On Error Resume Next
v = Application.Dialogs(xlDialogImportTextFile).Show()
'check v value if user clikc ok or cancel (cancel- false i believe)

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"wgl" wrote:

I am trying to initiate the Import External Data Wizard using code. I'm using
Excel 2003. I've tried using the following code:
Dim ImportData As CommandBarButton
Set ImportData = CommandBars("Worksheet Menu Bar") _
.Controls("Data").Controls("Import External Data").Controls("Import
&Data...")
ImportData.Execute

The above code results in the following error.
2147467259 - Execute Failed

I also tried to use Application.Dialogs, but I was not able to find the
right dialog.

How can I accomplish this?



All times are GMT +1. The time now is 05:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com