![]() |
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. |
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. |
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. |
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. |
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? |
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 |
FileName
That's the ticket, thanks very much Tom and Dave.
"Dave Peterson" wrote: Try: if Lcase(ActiveWorkbook.Name) = .... |
All times are GMT +1. The time now is 02:01 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com