Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-10-2022, 08:46 AM
lourid lourid is offline Open txt file with macro Windows 10 Open txt file with macro Office 2010
Novice
Open txt file with macro
 
Join Date: Feb 2022
Posts: 11
lourid is on a distinguished road
Default Open txt file with macro

Hello everybody
I have this code that gives me error .... instruction in red, it should open a dialog box to choose a txt file.



[SIZE="2"]Private Sub CommandButton3_Click()

filetoOpen = Application _
.GetOpenFilename("Text Files (*.txt), *.txt")



Workbooks.OpenText Filename:=
filetoOpen , Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier _
:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:= _
False, 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)), _
TrailingMinusNumbers:=True





End Sub[/SIZE]
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open txt file with macro Macro now requires file extension entered to open document Rampum15 Word VBA 2 12-09-2019 06:19 AM
Every Folder I open goes into File Explorer but when I click on a file it won't open bird dog Word 3 10-08-2019 10:03 AM
Open txt file with macro Macro to open Multiple files and copy information to a master file gbaker Excel Programming 2 04-08-2016 08:44 AM
Open txt file with macro Formula to open external file with specific program (like open with) pemartins Excel 16 02-24-2014 11:39 PM
Open txt file with macro excel cannot open the file .xlsx because the file format or file extension is not val teddysika Excel 1 11-22-2012 06:06 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:07 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft