#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default FileName

I need help with a macro that needs to do the following things:

1. Look at workbook filename.
2. If it is equal to a certain filename, then bring up a message box.
3. Have one button link to the Save As.. function.
4. Have one button to just cancel, and enter the workbook.
5. If the workbook has a different name, then have it just open the workbook
without the messagebox.

Any help would be greatly appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default FileName

msgbox buttons don't link. You can return a value

ans = msgbox("Desires",vbYesNo)
if ans = vbYes then
do something
else
do something else
End if

--
Regards,
Tom Ogilvy


"andy" wrote in message
...
I need help with a macro that needs to do the following things:

1. Look at workbook filename.
2. If it is equal to a certain filename, then bring up a message box.
3. Have one button link to the Save As.. function.
4. Have one button to just cancel, and enter the workbook.
5. If the workbook has a different name, then have it just open the

workbook
without the messagebox.

Any help would be greatly appreciated.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default FileName

Ok, sorry I worded it wrong. I am more interested in finding out a macro to
do the following:

1. Look at the active workbook Filename.
2. If the filename is still the same as one specified in the macro, then
have it open up a message box.
3. If the Filename is different, then have it just open the workbook as
normal without the message box.

Don't worry about anything else to do with the message box, all I want to
know is how to do the above.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default FileName

If lcase(activeworkbook.FileName) = lcase("Myfile.xls") then
msgbox "Name as specified"
else
workbooks.open "C:\Myfolder\Myfile.xls"
end if

--
Regards,
Tom Ogilvy

"andy" wrote in message
...
Ok, sorry I worded it wrong. I am more interested in finding out a macro

to
do the following:

1. Look at the active workbook Filename.
2. If the filename is still the same as one specified in the macro, then
have it open up a message box.
3. If the Filename is different, then have it just open the workbook as
normal without the message box.

Don't worry about anything else to do with the message box, all I want to
know is how to do the above.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default FileName

Thanks for the help, but i'm still having problems. This is what I have so far:

Private Sub Workbook_Open()

If LCase(ActiveWorkbook.Filename) = LCase("Nights Template V2.xls") Then
MsgBox "Name as specified"
Else
Worksheets("Startup").Activate
End If

End Sub

But I get the following:

Run-Time error '438':

Object doesn't support this property or method

Do you know what the problem is?




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default FileName

Try:

if Lcase(ActiveWorkbook.Name) = ....



andy wrote:

Thanks for the help, but i'm still having problems. This is what I have so far:

Private Sub Workbook_Open()

If LCase(ActiveWorkbook.Filename) = LCase("Nights Template V2.xls") Then
MsgBox "Name as specified"
Else
Worksheets("Startup").Activate
End If

End Sub

But I get the following:

Run-Time error '438':

Object doesn't support this property or method

Do you know what the problem is?



--

Dave Peterson
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
Cell("filename") doesn't update to new filename when do save as. Louis Excel Worksheet Functions 2 March 22nd 07 07:27 PM
set filename to <filename-date on open bob engler Excel Worksheet Functions 2 July 13th 06 05:11 AM
% in Filename Paul Black[_2_] Excel Programming 6 June 5th 05 11:59 AM
Saving filename same as import filename Matt Excel Programming 4 February 24th 04 03:01 PM
how to specify the filename gptg13 Excel Programming 0 December 18th 03 11:31 PM


All times are GMT +1. The time now is 10:05 PM.

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"