Hi there does anyone know if there is any code for opening a text file where the user can select which file. path to use ?
Last edited by WasWodge; 07-16-2011 at 06:22 PM.
Using Excel 2010
Normally need to save as Excel 97-2003 for other colleagues
Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown
Hi again, I am just posting to say I have found a partial solution thanks to a thread I have found in this forum.
http://www.excelforum.com/word-progr...es-wanted.html which recommended going to http://word.mvps.org/.
On that site I found the code below which works for what I need (after I changedtomsoFileDialogFolderPickerthat is until I actually select a txt file, the box which starts off saying "open" changes to "ok" and when I click on it nothing appears to happen other than it moves on tomsoFileDialogFilePickerDoes anyone have an idea how to amend it so it actually opens the file?MsgBox "You chose " & .SelectedItems(1)
Many thanks to JeanRage for the suggestion so far. Getting close (I think)
With Application.FileDialog(msoFileDialogFolderPicker) .AllowMultiSelect = False If .Show <> 0 Then MsgBox "You chose " & .SelectedItems(1) Else MsgBox "Dialog cancelled" End If End With
Using Excel 2010
Normally need to save as Excel 97-2003 for other colleagues
Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown
orSub snb() With Application.Dialogs(wdDialogFileOpen) .Name = "*.txt" .Show End With end sub
Sub snb() with Application.Dialogs(wdDialogInsertFile) .name="*.txt" .Show end with end sub
Last edited by snb; 07-14-2011 at 06:01 PM.
Thanks a million for that Snb. I have been scouring the web on and off for days looking for the correct syntax for this.
Thats the last thing I needed to do on this macro.
Thankfully I can go back to excel now until I get a word vba book.
Cheers for the solution
Using Excel 2010
Normally need to save as Excel 97-2003 for other colleagues
Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown
You don't have to look on Internet but in the helpfiles of Word's VBEditor .
PS. Can you please enable PM's in this forum ? on ICQ no matches for you were found...
Last edited by snb; 07-15-2011 at 03:44 AM.
I did try using the search in the VBEditor originally but obviously I didn't use the correct search term. I have now typed in "application dialog" and now have lots of explanation. So thanks for that suggestion.
I have now enabled PM's for all users (It was enabled for moderators and contacts).
I didn't have it enabled because I thought in general it goes against the principle of a public forum but obviously in some cases others feel it is of use.
I have also marked the thread as solved which I must have missed doing the other day. Apologises for that.
Using Excel 2010
Normally need to save as Excel 97-2003 for other colleagues
Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks