Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Paste to Find dialog box using a macro

Manually I can paste a value into the Find what: field of the find dialog
box (Ctrl+F, Ctrl+V). However, when I attempt to record this into a macro,
the macro will not record it.

Am I missing something?

Thanks, for any help you can offer.
Dan

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Paste to Find dialog box using a macro

Option Explicit
Sub testme()

Dim MyData As DataObject
Dim myStr As String

Set MyData = New DataObject

myStr = "" 'or whatever you want if there's no text in the clipboard

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

'maybe this, too???
myStr = Replace(myStr, vbCrLf, " ")
myStr = Replace(myStr, vbCr, " ")
myStr = Replace(myStr, vbLf, " ")

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

End Sub

Chip Pearson has some notes that you'll want to read.
http://www.cpearson.com/excel/clipboard.htm

Especially the note about using tools|references and checking "Microsoft Forms
2.0 object library").

danno-c wrote:

Manually I can paste a value into the Find what: field of the find dialog
box (Ctrl+F, Ctrl+V). However, when I attempt to record this into a macro,
the macro will not record it.

Am I missing something?

Thanks, for any help you can offer.
Dan


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Paste to Find dialog box using a macro

I got a compile error from the Dim MyData As DataObject line. I'm looking
through the help files now to see what i can do. I'm sure this is just a
newbie problem on my end.



"Dave Peterson" wrote:

Option Explicit
Sub testme()

Dim MyData As DataObject
Dim myStr As String

Set MyData = New DataObject

myStr = "" 'or whatever you want if there's no text in the clipboard

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

'maybe this, too???
myStr = Replace(myStr, vbCrLf, " ")
myStr = Replace(myStr, vbCr, " ")
myStr = Replace(myStr, vbLf, " ")

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

End Sub

Chip Pearson has some notes that you'll want to read.
http://www.cpearson.com/excel/clipboard.htm

Especially the note about using tools|references and checking "Microsoft Forms
2.0 object library").

danno-c wrote:

Manually I can paste a value into the âœFind what:❠field of the find dialog
box (Ctrl+F, Ctrl+V). However, when I attempt to record this into a macro,
the macro will not record it.

Am I missing something?

Thanks, for any help you can offer.
Dan


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Paste to Find dialog box using a macro

Found it.
It's all good now.
Great link.

Thanks,
Dan

"danno-c" wrote:

I got a compile error from the Dim MyData As DataObject line. I'm looking
through the help files now to see what i can do. I'm sure this is just a
newbie problem on my end.



"Dave Peterson" wrote:

Option Explicit
Sub testme()

Dim MyData As DataObject
Dim myStr As String

Set MyData = New DataObject

myStr = "" 'or whatever you want if there's no text in the clipboard

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

'maybe this, too???
myStr = Replace(myStr, vbCrLf, " ")
myStr = Replace(myStr, vbCr, " ")
myStr = Replace(myStr, vbLf, " ")

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

End Sub

Chip Pearson has some notes that you'll want to read.
http://www.cpearson.com/excel/clipboard.htm

Especially the note about using tools|references and checking "Microsoft Forms
2.0 object library").

danno-c wrote:

Manually I can paste a value into the âœFind what:❠field of the find dialog
box (Ctrl+F, Ctrl+V). However, when I attempt to record this into a macro,
the macro will not record it.

Am I missing something?

Thanks, for any help you can offer.
Dan


--

Dave Peterson

Reply
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 do I write a macro to show the find dialog box in excel 2003 evets Excel Discussion (Misc queries) 1 July 6th 08 01:11 PM
Macro to find and paste rows kayabob Excel Discussion (Misc queries) 4 February 21st 07 01:50 AM
Macro to Find, Cut, and Paste Rob Excel Discussion (Misc queries) 3 September 1st 05 09:37 PM
I need a macro to find cut and paste data to new cell Rex Excel Discussion (Misc queries) 0 December 6th 04 12:45 AM
I need a macro to find cut and paste data to new cell Rex Excel Discussion (Misc queries) 0 December 6th 04 12:23 AM


All times are GMT +1. The time now is 06:10 AM.

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

About Us

"It's about Microsoft Excel"