Who can translate this to VBA: If ActiveDocument.Path contains "hallo" then ...

W

Werner Pertl

Hi there!

Another "little" question:

How can I "translate" the following conditon to vba?

If ActiveDocument.Path contains "hallo" then ...

Thank you very much in advance!

Werner
 
J

Jonathan West

Hi Werner

If InStr(ActiveDocument.Path, "hallo") > 0 Then
' contains hallo
Else
' doesn't
End if
 
M

Martin Seelhofer

Hi Werner

One of the possible solutions is:

If ActiveDocument.Path Like "*hallo*" then ...

Another one is:

If Instr(ActiveDocument.Path,"hallo")>0 then...


Cheers,
Martin
 
W

Werner Pertl

Hi Martin,
thank you very much for your answer!
Will try both versions, it's always good to learn new things.
Thanks again!
Werner
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top