LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to open another workbook

I am using Excel 2003 and am trying to write a macro that will ope
another workbook.

I don't want users to be able to hit the x-button to close out, but
do want them to be able to hit a cancel button and return to th
original workbook.

This is what I have so far, but it only allows for the msg to appea
once, and it if somebody wants to cancel, they get a debug message.


Filename = Application.GetOpenFilename(, , "Select SPS_Shee
file")

If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox "You can't close the dialog like this!"
End If

Filename = Application.GetOpenFilename(, , "Select SPS_Shee
file")

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(Filename)
s = f.DateCreated

Workbooks.Open Filename

Thanks in advance for your help!
-Meliss

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

 
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
Macro in 2nd Open workbook Steve Excel Discussion (Misc queries) 1 January 28th 08 05:35 PM
Open Workbook Macro??? Supe Excel Discussion (Misc queries) 2 December 19th 07 08:37 PM
how can I run a macro when I open a workbook? filo666 Excel Discussion (Misc queries) 2 March 2nd 05 07:56 PM
Open & run a workbook macro. Julian Milano[_2_] Excel Programming 7 January 29th 04 12:40 AM
How to run VBA macro when the workbook is open? Ji Wenke Excel Programming 1 July 9th 03 03:22 AM


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