This is easy but somehow I cant get it
I have a macro that I want to execute only if the workbook has a particualr
file name
so something like
If workbooks.name = quot; sample.xlsquot; then
' do something
else
' do nothing
end if
end sub
however, what I found was that no matter what the file name, the macro still
goes ahead and get executeddim wkbk as workbook
set wkbk = activeworkbook
if trim(lcase(wkbk.name)) = trim(lcase(quot;sample.xlsquot;)) then
'do something
else
'do something else
end if
flow23 wrote:
gt;
gt; This is easy but somehow I cant get it
gt;
gt; I have a macro that I want to execute only if the workbook has a particualr
gt; file name
gt;
gt; so something like
gt; If workbooks.name = quot; sample.xlsquot; then
gt; ' do something
gt; else
gt; ' do nothing
gt; end if
gt; end sub
gt;
gt; however, what I found was that no matter what the file name, the macro still
gt; goes ahead and get executed
--
Dave Peterson
many thanksquot;Dave Petersonquot; wrote:
gt; dim wkbk as workbook
gt; set wkbk = activeworkbook
gt;
gt; if trim(lcase(wkbk.name)) = trim(lcase(quot;sample.xlsquot;)) then
gt; 'do something
gt; else
gt; 'do something else
gt; end if
gt;
gt;
gt;
gt; flow23 wrote:
gt; gt;
gt; gt; This is easy but somehow I cant get it
gt; gt;
gt; gt; I have a macro that I want to execute only if the workbook has a particualr
gt; gt; file name
gt; gt;
gt; gt; so something like
gt; gt; If workbooks.name = quot; sample.xlsquot; then
gt; gt; ' do something
gt; gt; else
gt; gt; ' do nothing
gt; gt; end if
gt; gt; end sub
gt; gt;
gt; gt; however, what I found was that no matter what the file name, the macro still
gt; gt; goes ahead and get executed
gt;
gt; --
gt;
gt; Dave Peterson
gt;
- Sep 23 Tue 2008 20:46
IF file name
close
全站熱搜
留言列表
發表留言
留言列表

