ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Finding Workbook name - HELP (https://www.excelbanter.com/excel-programming/413654-finding-workbook-name-help.html)

Jim

Finding Workbook name - HELP
 
I need to show an inputform only when a certain workbook is open. the problem
i am having is that when i open the file, i input info into the inputform and
when i hit enter, it saves a copy of the file as another name but with the
same code, hense "inputform.show" stuff. I dont want the new file name to
show the inputform when it is open, only show when origional is opened.
something like this maybe? thx

If WorkbookName = "Filename.xls" Then
InputForm.Show
Else
Do nothing
End If

JLGWhiz

Finding Workbook name - HELP
 
Hi Jim, A built in quirk in Excel is that if you save the file that is
running the code module under a different name, it takes the code right along
with it. One way around it is to just copy the sheets from one workbook to
another, or another way is to put your code in a separate workbook than the
one you are saving.

"Jim" wrote:

I need to show an inputform only when a certain workbook is open. the problem
i am having is that when i open the file, i input info into the inputform and
when i hit enter, it saves a copy of the file as another name but with the
same code, hense "inputform.show" stuff. I dont want the new file name to
show the inputform when it is open, only show when origional is opened.
something like this maybe? thx

If WorkbookName = "Filename.xls" Then
InputForm.Show
Else
Do nothing
End If


Tom Ogilvy

Finding Workbook name - HELP
 
If lcase(Application.Thisworkbook.Name) = lcase("Filename.xls") Then
InputForm.Show
Else
Do nothing
End If

--
Regards,
Tom Ogilvy


"Jim" wrote:

I need to show an inputform only when a certain workbook is open. the problem
i am having is that when i open the file, i input info into the inputform and
when i hit enter, it saves a copy of the file as another name but with the
same code, hense "inputform.show" stuff. I dont want the new file name to
show the inputform when it is open, only show when origional is opened.
something like this maybe? thx

If WorkbookName = "Filename.xls" Then
InputForm.Show
Else
Do nothing
End If


Jim

Finding Workbook name - HELP
 
THANKS TOM, WORKS GREAT

"Tom Ogilvy" wrote:

If lcase(Application.Thisworkbook.Name) = lcase("Filename.xls") Then
InputForm.Show
Else
Do nothing
End If

--
Regards,
Tom Ogilvy


"Jim" wrote:

I need to show an inputform only when a certain workbook is open. the problem
i am having is that when i open the file, i input info into the inputform and
when i hit enter, it saves a copy of the file as another name but with the
same code, hense "inputform.show" stuff. I dont want the new file name to
show the inputform when it is open, only show when origional is opened.
something like this maybe? thx

If WorkbookName = "Filename.xls" Then
InputForm.Show
Else
Do nothing
End If



All times are GMT +1. The time now is 02:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com