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

is there a way to open a file in macro where the user
selects the file...like opens the "open file dialogue box"

something like
Sub Macro1()

Workbooks.Open Filename:= _
"C:\Documents and Settings\test.xls _
UpdateLinks:=0
End Sub

but the file name can be chosen by the use?
thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default excel open file macro

As in:

myFile = Application.GetOpenFilename("Excel Files,*.xls")

See OLH for GetOpenFilename Method


--
HTH
Roger
Shaftesbury (UK)


"doug" wrote in message
...
is there a way to open a file in macro where the user
selects the file...like opens the "open file dialogue box"

something like
Sub Macro1()

Workbooks.Open Filename:= _
"C:\Documents and Settings\test.xls _
UpdateLinks:=0
End Sub

but the file name can be chosen by the use?
thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default excel open file macro

Note that this doesn't open the file, it just returns the full path and name
of the selected file. The file has to be separately opened.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Roger Whitehead" wrote in message
...
As in:

myFile = Application.GetOpenFilename("Excel Files,*.xls")

See OLH for GetOpenFilename Method


--
HTH
Roger
Shaftesbury (UK)


"doug" wrote in message
...
is there a way to open a file in macro where the user
selects the file...like opens the "open file dialogue box"

something like
Sub Macro1()

Workbooks.Open Filename:= _
"C:\Documents and Settings\test.xls _
UpdateLinks:=0
End Sub

but the file name can be chosen by the use?
thanks





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default excel open file macro

Thats right Bob, my apologies Doug - moe complete code would be:

myFile = Application.GetOpenFilename("Excel Files,*.xls")
workbooks.open myfile
'or
workbooks.open Filename:=myfile

Check out OLH for full syntax

Roger

"Bob Phillips" wrote in message
...
Note that this doesn't open the file, it just returns the full path and

name
of the selected file. The file has to be separately opened.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Roger Whitehead" wrote in message
...
As in:

myFile = Application.GetOpenFilename("Excel Files,*.xls")

See OLH for GetOpenFilename Method


--
HTH
Roger
Shaftesbury (UK)


"doug" wrote in message
...
is there a way to open a file in macro where the user
selects the file...like opens the "open file dialogue box"

something like
Sub Macro1()

Workbooks.Open Filename:= _
"C:\Documents and Settings\test.xls _
UpdateLinks:=0
End Sub

but the file name can be chosen by the use?
thanks







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
Open Excel file from VB and open MACRO no1jimmyman Excel Discussion (Misc queries) 0 February 14th 11 10:10 PM
create a macro to automatically open excel another excel file [email protected] uk Excel Discussion (Misc queries) 1 July 20th 08 09:21 PM
Open an Excel file with a date as today in a macro Perry Excel Discussion (Misc queries) 4 November 10th 05 09:57 AM
Automate open file, update links, run macro, close and save file Geoff[_7_] Excel Programming 2 August 26th 03 10:13 PM
Open Winword-file using a Excel 97 VBA macro Dominik Scheck Excel Programming 4 August 5th 03 02:35 AM


All times are GMT +1. The time now is 12:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"