Error 438 on SetFocus

Posted on 2016-08-28
Last Modified: 2016-10-03
I am getting error code 438 with below code.

Private Sub Workbook_Open()

'On Error Resume Next
    a = Application.ThisWorkbook.Path & "\" & "CIMSR339A.DBF"
    If Dir(a) <> "" Then
        Sheets(1).TPath.Text = a
        Sheets(1).TPath.Text = "Please browse the file."
    End If

Dim DataObj As DataObject
Set DataObj = New DataObject


If Application.ClipboardFormats(1) = xlClipboardFormatText Then
    Sheets(1).TName.Text = DataObj.GetText(1)
End If

End Sub
Question by:Mukund Patel
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 21

Accepted Solution

crystal (strive4peace) - Microsoft MVP, Access earned 250 total points (awarded by participants)
ID: 41773712
what about using Select instead of SetFocus?
LVL 48

Assisted Solution

by:Martin Liss
Martin Liss earned 250 total points (awarded by participants)
ID: 41773760
Activate would be better than Select. Also your use of of TPath and TName are invalid.
LVL 21
ID: 41773763
if these are range names:
Application.Goto Reference:="rangename"

Open in new window


Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question