Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to call File Open / Save Window in a Macro

I would appreciate if anybody give me a solution on...

I have a macro that opens a text file into Excel 2000
thru. text import wizard.
I want to fine tune it... like when I run the macro
it should popup the "File Open" window and allow to select
the text file to import from any drive/folder.

Similarly after import process is over the macro should
popup the window "Save as", so as to save at desired
drive/folder.

How to do this???

Thanks in Adv
Shanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How to call File Open / Save Window in a Macro

Hi Shanks,


Dim sFile
sFile = Application.GetOpenFilename("Text Files (*.txt), *.txt")
If sFile < False Then
Workbooks.OpenText Filename:=sFile, _
Origin:=xlWindows, _
StartRow:=1, _
DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(10, 1), _
Array(21, 1), Array(52, 1), _
Array(62, 1), Array(105, 1), _
Array(117, 1), Array(135, 1),
Array(157, 1))

'do your bit
sFile = Application.GetSaveAsFilename(, "Text Files (*.txt), *.txt")
If sFile < False Then
ActiveWorkbook.SaveAs Filename:=sFile
End If
End If



--

HTH

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

" wrote in message
...
I would appreciate if anybody give me a solution on...

I have a macro that opens a text file into Excel 2000
thru. text import wizard.
I want to fine tune it... like when I run the macro
it should popup the "File Open" window and allow to select
the text file to import from any drive/folder.

Similarly after import process is over the macro should
popup the window "Save as", so as to save at desired
drive/folder.

How to do this???

Thanks in Adv
Shanks



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
2007 Macro to Open File, Delete Contents, Save New File Flintstone[_2_] Excel Discussion (Misc queries) 2 February 1st 10 11:25 PM
Vista Office 2003 File Open Window @details will only show file n. amb@HKD Excel Discussion (Misc queries) 1 September 3rd 09 01:03 AM
Open Another Workbook and Call Macro Bill Oertell[_2_] Excel Programming 1 January 20th 04 04:29 AM
Auto_Open vs Open and call macro --priority question John Baker Excel Programming 3 December 7th 03 04:26 PM
Automate open file, update links, run macro, close and save file Geoff[_7_] Excel Programming 2 August 26th 03 10:13 PM


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