Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
mario milani
 
Posts: n/a
Default macro interruption: help!!!

Thank you Dave your macro works perfectly...
It's the first I use "news group" I'm sorry if I haven't familiarity
with it. Sorry for my english too.
Mario


Dave Peterson wrote in message ...
One way:

Option Explicit
Sub testme()

Dim myFileName As Variant

myFileName = Application.GetOpenFilename(filefilter:="Text Files, *.Txt", _
Title:="Pick a File")

If myFileName = False Then
MsgBox "Ok, try later" 'user hit cancel
Exit Sub
End If

Workbooks.OpenText Filename:=myFileName '....rest of recorded code here!

End Sub

Mario wrote:

Hi everybody

I created a macro who open a textfile and divides it in columns

The macro doesn't give the possibility of choosing the file to open. (it
always opens the file I choose when I registerd it)

I would like it gives the possibility to choose the file and then it started
again... how can I do?

Thi is the macro:
Workbooks.OpenText Filename:= _
"C:\Documents and
Settings\b0\Documenti\Attivita\PmiSolution\clienti \GM\2004\NSCADFAG.scadfor"
_
, Origin:=xlWindows, StartRow:=1, DataType:=xlFixedWidth,
FieldInfo:= _
Array(Array(0, 1), Array(31, 1), Array(39, 9), Array(46, 4),
Array(54, 1), Array(72, 1), _
Array(73, 4), Array(82, 1), Array(114, 1))
End Sub

Thanks
Mario

  #2   Report Post  
mario milani
 
Posts: n/a
Default

Thank you Stefan your macro works perfectly...
It's the first time I use "news group" I'm sorry if I haven't
familiarity with it. Sorry for my english too.
Mario


"Stefan Hägglund [MSFT]" wrote in message ...
Hi Mario,

Try this code:

Sub OpenTextFile()
Dim MyFile As Variant
' Ask the user for the file name to open.
MyFile = Application.GetOpenFilename
' Check for the Cancel button.
If MyFile = False Then Exit Sub
' Open the Text file with the OpenText method.
Workbooks.OpenText Filename:=MyFile, Origin:=xlWindows, _
StartRow:=1, DataType:=:=xlFixedWidth, FieldInfo:= _
Array(Array(0, 1), Array(31, 1), Array(39, 9), Array(46, 4), Array(54, 1),
Array(72, 1), _
Array(73, 4), Array(82, 1), Array(114, 1))
End Sub

Best regards

Stefan Hägglund
Microsoft





"Mario" wrote in message
. ..
Hi everybody

I created a macro who open a textfile and divides it in columns

The macro doesn't give the possibility of choosing the file to open. (it
always opens the file I choose when I registerd it)

I would like it gives the possibility to choose the file and then it
started again... how can I do?

Thi is the macro:
Workbooks.OpenText Filename:= _
"C:\Documents and
Settings\b0\Documenti\Attivita\PmiSolution\clienti \GM\2004\NSCADFAG.scadfor"
_
, Origin:=xlWindows, StartRow:=1, DataType:=xlFixedWidth,
FieldInfo:= _
Array(Array(0, 1), Array(31, 1), Array(39, 9), Array(46, 4),
Array(54, 1), Array(72, 1), _
Array(73, 4), Array(82, 1), Array(114, 1))
End Sub

Thanks
Mario

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
select worksheet to run macro Hidaya Excel Discussion (Misc queries) 5 December 1st 04 11:54 PM
Macro help Jeff Garrett Excel Discussion (Misc queries) 11 December 1st 04 08:47 PM
Removing Unnecessary Macro Security Warnings o0icebox0o Excel Discussion (Misc queries) 1 November 30th 04 12:09 AM
Macro for Show/Hide Column Andy Excel Discussion (Misc queries) 2 November 26th 04 01:03 PM
This one is tricky....Macro to save file as cell value x in di Andy Excel Discussion (Misc queries) 4 November 26th 04 08:52 AM


All times are GMT +1. The time now is 10:40 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"