File opening dialog from excel VBA form

S

schaperot

Hi to all,

I am producing macro for Excel,

From one form, I need to select a file to import data from it (it is not an
excel
file, just text with data, with an unusual extension).
Therefore, I need to use CommDlg32.ocx and ShowOpen.

This works fine when this excel file is running and editing on my
delveloppement PC.

When I try to edit this file (from VBA) on destination PC, or when I try to
save this excel
file on destination PC, errors are appearing. It seems that I do not have
the developpement
licence for CommDlg32.ocx on destination PC.

What should I do
. To select a file without CommDlg32.ocx ?
or
. To install CommDlg32.ocx as a developpement tool ?

Thanks for answer,

Stephane.
 
P

Petro

Hey,
I do it with:

Workbooks.OpenText Filename:="U:\Eigene
Dateien\ums071.xyz", Origin:= _
xlMSDOS, StartRow:=1, DataType:=xlDelimited,
TextQualifier:=xlDoubleQuote _
, ConsecutiveDelimiter:=False, Tab:=True,
Semicolon:=True, Comma:=False _
, Space:=False, Other:=False, FieldInfo:=Array
(Array(1, 1), Array(2, 1), _
Array(3, 1), Array(4, 1), Array(5, 1), Array(6,
1), Array(7, 1), Array(8, 1), Array(9, 1)), _
TrailingMinusNumbers:=True

and it with all extensions.

Petro
 
C

Chad DeMeyer

Look up the GetOpenFileName method in Excel VBA help. I think it will
accomplish the same thing that you are trying to accomplish with the common
dialog control.

Regards,
Chad DeMeyer
 
S

schaperot

Look up the GetOpenFileName method in Excel VBA help. I think it will
accomplish the same thing that you are trying to accomplish with the common
dialog control.

Thanks a lot !

That's exactly what I was looking for !

Have a good week end,

Stephane.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top