Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA code to open file?

Does anyone know the line of code to open a file? I have created a macro
and am programming in VBA. All I need is the code which opens up files.
Any help is really appreciated.


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default VBA code to open file?

If You want to open an excel file use this:
Workbooks.Open file_name

text file in Excel:
Workbooks.OpenText file_name
for example:
Workbooks.OpenText filename:="DATA.TXT", _
dataType:=xlDelimited, tab:=True


if it is a text file and You want to read from it:
Open file_name For Input As #1

write to a file
Open file_name For Output As #1

Read the online help for open method to get more info


"pgoodale" wrote in message
...
Does anyone know the line of code to open a file? I have created a macro
and am programming in VBA. All I need is the code which opens up files.
Any help is really appreciated.


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default VBA code to open file?

You simply want to open a workbook?

Workbooks.Open "path"

or something completely different, like a word file?

Sub StartWinWord()
Dim RetVal
RetVal = Shell("C:\Program Files\Microsoft _
Office\Office10\WinWord.exe c:\boot.ini", 1)

End Sub

On Tue, 30 Dec 2003 03:31:55 -0600, pgoodale
wrote:

Does anyone know the line of code to open a file? I have created a macro
and am programming in VBA. All I need is the code which opens up files.
Any help is really appreciated.


---
Message posted from http://www.ExcelForum.com/


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default VBA code to open file?

Use the macro recorder to create the code you need, it is far simpler than
trying to work out the intricacies of writing the code directly, especially
for simple code.

Cheers
N

"pgoodale" wrote in message
...
Does anyone know the line of code to open a file? I have created a macro
and am programming in VBA. All I need is the code which opens up files.
Any help is really appreciated.


---
Message posted from http://www.ExcelForum.com/





----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default VBA code to open file?

You could have posted your code for comments and suggestions. Or, you could
have looked in vba HELP index for OPEN
We help those who help themselves.
--
Don Guillett
SalesAid Software

"pgoodale" wrote in message
...
Does anyone know the line of code to open a file? I have created a macro
and am programming in VBA. All I need is the code which opens up files.
Any help is really appreciated.


---
Message posted from
http://www.ExcelForum.com/



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
Which 'event' to run pivot chart formatting code on file open? David Charts and Charting in Excel 1 June 11th 09 02:22 PM
open file with code Steve Excel Discussion (Misc queries) 1 April 24th 09 08:21 PM
How to Open a file with the help of a code in Excel Pranay Shah New Users to Excel 3 August 22nd 07 02:42 PM
Code to Open Excel File Please Help Cole Excel Discussion (Misc queries) 2 July 10th 06 09:04 PM
Use VBA code to open a text file with the import wizard George Wilson[_2_] Excel Programming 2 September 10th 03 07:55 PM


All times are GMT +1. The time now is 06:03 PM.

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"