Lotus notes VB code

Below is a snippet of code i have for sending emails via lotus notes from from windows directories.

Underneath the array part is line

    stFilenameTmp = str & " - " & stItem & " (" & Format(Cells(5, 15).Value, "mmm-yy") & ") - Managed .pdf"

I dont understand how its able to look for booked, booked region etc when the above line seems hardcoded to Managed .pdf

Thanks


stpath = "R:\SPM\Horis Info\Horis_Project\GBM\" & Format(Cells(5, 15).Value, "mmm-yy") & "\Output\" & Cells(5, 13).Value & "\All"

For Each stItem In Array("GB-CORP", "GB-FI", "CMB-LC", "MME")
    stFilenameTmp = str & " - " & stItem & " (" & Format(Cells(5, 15).Value, "mmm-yy") & ") - Managed .pdf"
    If Len(Dir(stpath & "\" & stFilenameTmp)) > 0 Then
        stComp = stItem
        Exit For
    End If
Next
    stfilename1 = str & " - " & stComp & " (" & Format(Cells(5, 15).Value, "mmm-yy") & ") - Managed .pdf"
    stfilename2 = str & " - " & stComp & " (" & Format(Cells(5, 15).Value, "mmm-yy") & ") - Booked .pdf"
    stfilename3 = str & " - " & stComp & " (" & Format(Cells(5, 15).Value, "mmm-yy") & ") - Booked Region .pdf"
    stfilename4 = str & " - " & stComp & " (" & Format(Cells(5, 15).Value, "mmm-yy") & ") - Managed.xlsx"
    stfilename5 = str & " - " & stComp & " (" & Format(Cells(5, 15).Value, "mmm-yy") & ") - Booked.xlsx"
    stfilename6 = str & " - " & stComp & " (" & Format(Cells(5, 15).Value, "mmm-yy") & ") - Booked Region.xlsx"
  

Open in new window

Seamus2626Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Saurabh Singh TeotiaCommented:
Seamus,

To give you a background in VBA the constant part is what is in double quotes and outside of the double quotes is the dynamic part which keeps changing and pick up values from where you ask them so in this line if you notice..

stFilenameTmp = str & " - " & stItem & " (" & Format(Cells(5, 15).Value, "mmm-yy") & ") - Managed .pdf"

In double quotes you have signs-->"-" and "(" and then your managed.pdf

Now variable part is str & stitem and cells(5,15).value which basically gets derived in the macro itself and it populates the stfilenametemp values which finally gets attached to your code...

thats how it's picking up different file names in the code..

You can put a breakpoint in your code by pressing f9 on this line and then press f8 which will move code only one step and then you can see the values of sfilenametemp as soon you hoover your mouse on top of it and similarly others variable values as well...

Saurabh...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Seamus2626Author Commented:
Are you saying i should have

  stFilenameTmp = str & " - " & stItem & " (" & Format(Cells(5, 15).Value, "mmm-yy") & ") - "" .pdf"

instead of

stFilenameTmp = str & " - " & stItem & " (" & Format(Cells(5, 15).Value, "mmm-yy") & ") - Managed .pdf"

Thanks
Saurabh Singh TeotiaCommented:
Depends.. if your file has managed in it..i will let it remain their as it's..However if it doesn't have that in the file name then i will remove it..it's completely dependent on whats your file name and how does it look like...
Seamus2626Author Commented:
Thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.