Access Run-time 13 Type mismatch

I get a type mismatch in the following line:

Call Shell("C:\Program Files (x86)\Adobe\Reader 11.0\Reader\acrord32.exe" / N / T / folder & "\" & file & ".pdf" / "WOC4FL-4177", vbNormalFocus)

Any thoughts on how to correct?

Here is the complete code;
Dim fd As FileDialog

Set fd = Application.FileDialog(msoFileDialogFolderPicker)
Dim vrtSelectedItem As Variant

TryAgain:
With fd
    .InitialView = msoFileDialogViewDetails ' msoFileDialogViewThumbnail
    .Title = "Folder Selector"
    '.InitialFileName = theFile
    .ButtonName = "Use this folder"
    .AllowMultiSelect = False

    'The user pressed the action button.
    If .Show = True Then
        If .SelectedItems.Count = 0 Then
            MsgBox "You didn't make a valid selection.  Try again!"
            GoTo TryAgain
        End If
       ' MsgBox .SelectedItems(1)


Dim file As String
 Dim folder As String
  folder = fd.SelectedItems(1)
 file = Dir(folder & "\*.pdf")
 Do Until Len(file) = 0
Call Shell("C:\Program Files (x86)\Adobe\Reader 11.0\Reader\acrord32.exe" / N / T / folder & "\" & file & ".pdf" / "WOC4FL-4177", vbNormalFocus)
   file = Dir
   Loop


   ' Else
        Exit Sub
    End If
End With
shieldscoAsked:
Who is Participating?
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.

Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
<<Call Shell("C:\Program Files (x86)\Adobe\Reader 11.0\Reader\acrord32.exe" / N / T / folder & "\" & file & ".pdf" / "WOC4FL-4177", vbNormalFocus)>>

Don't see where "file" is defined (use option explicit at the top of a module always) and you've a problem with the quoting at the end there after the ".PDF" (should be: ".pdf / WOC4FL-4177" or possibly a type and should be ".pdf" & "WOC4FL-4177").

A better way to see your mistakes is to do this (and this is good with SQL Statements to:

strCommand = "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\acrord32.exe" / N / T / folder & "\" & file & ".pdf" / "WOC4FL-4177"
Call Shell(strCommand, vbNormalFocus)

 Now you'll find it very easy to spot your mistake.

Jim.
0
Gustav BrockCIOCommented:
Try this:
Call Shell("C:\Program Files (x86)\Adobe\Reader 11.0\Reader\acrord32.exe /N /T /" & folder & "\" & file & ".pdf /WOC4FL-4177", vbNormalFocus)

Open in new window

though  /WOC4FL-4177 seems strange to me.

/gustav
0

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
shieldscoAuthor Commented:
same problem type mismatch using your suggested changes
0
Gustav BrockCIOCommented:
What should the command line look like?

Perhaps you need a quoted path:
Call Shell(Chr(34) & "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\acrord32.exe" & Chr(34) & " /N /T /" & Chr(34) & "folder & "\" & file & ".pdf" & Chr34) & " /WOC4FL-4177", vbNormalFocus)

Open in new window

/gustav
0
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
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.