Import files on a mac

A

Andreas Roschger

Hello!

I wrote on a PC a macro to import more then one file.
Here is the code to geht the paths of the files, chosen in the dialog
window:
On th PC there were no errors
-----------------
Public

Sub DateinEinlesn()
Dim varRetVal As Variant
Dim n As Integer

varRetVal = Application.GetOpenFilename( _
FileFilter:="Text-Datein (*.txt), *.txt", _
Title:="Eine oder mehrere Dateien zum Öffnen auswählen", _
MultiSelect:=True)
MsgBox (varRetVal(1) & " " & varRetVal(2))
End Sub


----------------

now i tried to use the macro on a Mac (OSX, newest Office version),
i adopt the code => (FileFilter:="Text")

-----------------
Public

Sub DateinEinlesn()
Dim varRetVal As Variant
Dim n As Integer

varRetVal = Application.GetOpenFilename( _
FileFilter:="TEXT", _
Title:="Eine oder mehrere Dateien zum Öffnen auswählen", _
MultiSelect:=True)
MsgBox (varRetVal(1) & " " & varRetVal(2))
End Sub


----------------

But there is still an error. I think that there a problems with
"MultiSelect:=True". Without this comand its possible to import one
File.

hope someone knows how to help me
thx
Andy
 
J

JE McGimpsey

Multiselect is not implemented in MacXL. You'll need to loop.



Andreas Roschger wrote:
 
A

Andreas Roschger

Multiselect is not implemented in MacXL. You'll need to loop.

May you give me an example of such a loop.
thx
Andy
 
D

Dave Peterson

Maybe??

Sub DateinEinlesn()
Dim varRetVal As Variant
Dim n As Integer

do

varRetVal = Application.GetOpenFilename( _
FileFilter:="Text-Datein (*.txt), *.txt", _
Title:="Eine oder mehrere Dateien zum Öffnen auswählen")

if varRetVal = false then exit do

MsgBox varRetVal

loop

End Sub
 
A

Andreas Roschger

Sub DateinEinlesn()
Dim varRetVal As Variant
Dim n As Integer

do

varRetVal = Application.GetOpenFilename( _
FileFilter:="Text-Datein (*.txt), *.txt", _
Title:="Eine oder mehrere Dateien zum Öffnen auswählen")

if varRetVal = false then exit do

MsgBox varRetVal

loop

End Sub

thx, but the problem is, that i have to import a lot of files....
any possibility to automate this?

Andy
 
D

Dave Peterson

Hmmm. I thought that this _was_ automated!

But if the filenames don't change, then maybe you could put all the names in a
worksheet and loop through that list.

From reading JE's post, it doesn't look like Mac's can get more than one file at
a time--using .getopenfilename.

I don't have any idea if there's a workaround solution on those Macs.
 

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