Solved

Error 438 on SetFocus

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

Private Sub Workbook_Open()

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

Dim DataObj As DataObject
Set DataObj = New DataObject

DataObj.GetFromClipboard

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

End Sub
0
Comment
Question by:Mukund Patel
  • 2
5 Comments
 
LVL 19

Accepted Solution

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

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.
0
 
LVL 19
ID: 41773763
if these are range names:
Application.Goto Reference:="rangename"

Open in new window

0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

856 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