LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Insert "Find dialog box" edits into macro

I'm using a macro calls the find dialog and pastes a value into the 'find
what:' field. The problem I am having is there is a null space at the end of
the pasted string (can't find string with the extra space) and I have to
manually hit End and Backspace then enter. Can anyone suggest some code that
I can insert into the macro to automate these keystrokes?

Code below.

Thanks,
Dan


Sub testme()
' code to open find dialog and paste clipboard contents as MyStr
Dim MyData As DataObject
Dim myStr As String

Set MyData = New DataObject

myStr = ""

On Error Resume Next
MyData.GetFromClipboard
myStr = MyData.GetText(1)
On Error GoTo 0

Application.Dialogs(xlDialogFormulaFind).Show arg1:=myStr

Selection.Copy
Sheets("Trip Detail").Select
Application.Goto Reference:="R1C1"
ActiveSheet.Paste
ActiveSheet.Paste
ActiveSheet.Paste
ActiveSheet.Paste

ActiveCell.Offset(0, -8).Range("A1:I1").Select
ActiveCell.Activate
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste
ActiveCell.Offset(1, 0).Range("A1").Select
Sheets("Trip Listing").Select
Application.Dialogs(xlDialogFormulaFind).Show arg1:=myStr
End Sub


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to delete the "Insert Function Dialog Box" (dialog box only)? TBI''d biker Excel Worksheet Functions 2 April 7th 07 09:18 PM
Scroll Bar missing "Control" tab in "Format Properties" dialog box Peter Rooney Excel Discussion (Misc queries) 5 August 24th 06 05:36 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Remove content of last visited pages in "Insert Hyperlink" dialog Excel bloke Excel Worksheet Functions 4 June 12th 06 12:37 AM
Replace dialog should put focus on "Find What" not "Replace With" Michael Williams Excel Discussion (Misc queries) 0 May 24th 06 12:45 PM


All times are GMT +1. The time now is 11:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"