Solved

Error 438 on SetFocus

Posted on 2016-08-28
5
26 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

786 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