Tags: 800a01a8, basic, clipboard, code, copy, error, excel, key, keystokes, message, microsoft, msdn, object, paste, required, software, stokes, visual

Visual Basic Copy Clipboard Paste as KeyStokes

On Microsoft » Microsoft Excel

19,310 words with 5 Comments; publish: Fri, 23 May 2008 00:01:00 GMT; (30677.15, « »)

I am getting an error message

error: object required: 'clipboard'

code: 800a01a8

i am trying to paste the clipboard as key stokes, and not just pasting data.

this is my first script, and i learned this yesterday, so please be nice as

i am a very newbie!!!

Set WshShell = WScript.CreateObject("WScript.Shell")

For a = 1 To 1

WshShell.AppActivate "MICROSOFT EXCEL"

WScript.Sleep 300

WshShell.SendKeys "{F2}"

WScript.Sleep 300

WshShell.SendKeys "{END}"

WScript.Sleep 300

WshShell.SendKeys "+{Home}"

WScript.Sleep 300

WshShell.SendKeys "^(c)"

WScript.Sleep 400

WshShell.AppActivate "MICRO KEY"

WScript.Sleep 1000

WshShell.SendKeys "{F2}"

WScript.Sleep 2000

WshShell.SendKeys "^(v)"

WScript.Sleep 4000

WshShell.SendKeys "~"

WScript.Sleep 1000

WshShell.SendKeys "%(Q)"

WScript.Sleep 300

WshShell.SendKeys "(R)"

WScript.Sleep 300

WshShell.SendKeys "(U)"

WScript.Sleep 4000

WshShell.SendKeys "^{INSERT}"

WScript.Sleep 300

WshShell.SendKeys "+{TAB}"

WScript.Sleep 300

WshShell.SendKeys "+{TAB}"

WScript.Sleep 300

WshShell.SendKeys "+{TAB}"

WScript.Sleep 1000

WshShell.AppActivate "MICROSOFT EXCEL"

WScript.Sleep 1000

WshShell.SendKeys "{TAB}"

WScript.Sleep 300

WshShell.SendKeys "{F2}"

WScript.Sleep 300

WshShell.SendKeys "{END}"

WScript.Sleep 300

WshShell.SendKeys "+{Home}"

WScript.Sleep 300

WshShell.SendKeys "^(c)"

WScript.Sleep 400

WshShell.AppActivate "MICRO KEY"

WScript.Sleep 400

Clipboard.SetText

WshShell.SendKeys.Send("^{v}")

Next

WScript.Quit

thanks in return!!!!!!!!!!!!!!!!

All Comments

Leave a comment...

  • 5 Comments
    • pretty much i am needing to know how to paste the clipboard as a macro

      "staciedaisy" wrote:

      > I am getting an error message

      > error: object required: 'clipboard'

      > code: 800a01a8

      > i am trying to paste the clipboard as key stokes, and not just pasting data.

      > this is my first script, and i learned this yesterday, so please be nice as

      > i am a very newbie!!!

      >

      > Set WshShell = WScript.CreateObject("WScript.Shell")

      > For a = 1 To 1

      > WshShell.AppActivate "MICROSOFT EXCEL"

      > WScript.Sleep 300

      > WshShell.SendKeys "{F2}"

      > WScript.Sleep 300

      > WshShell.SendKeys "{END}"

      > WScript.Sleep 300

      > WshShell.SendKeys "+{Home}"

      > WScript.Sleep 300

      > WshShell.SendKeys "^(c)"

      > WScript.Sleep 400

      > WshShell.AppActivate "MICRO KEY"

      > WScript.Sleep 1000

      > WshShell.SendKeys "{F2}"

      > WScript.Sleep 2000

      > WshShell.SendKeys "^(v)"

      > WScript.Sleep 4000

      > WshShell.SendKeys "~"

      > WScript.Sleep 1000

      > WshShell.SendKeys "%(Q)"

      > WScript.Sleep 300

      > WshShell.SendKeys "(R)"

      > WScript.Sleep 300

      > WshShell.SendKeys "(U)"

      > WScript.Sleep 4000

      > WshShell.SendKeys "^{INSERT}"

      > WScript.Sleep 300

      > WshShell.SendKeys "+{TAB}"

      > WScript.Sleep 300

      > WshShell.SendKeys "+{TAB}"

      > WScript.Sleep 300

      > WshShell.SendKeys "+{TAB}"

      > WScript.Sleep 1000

      > WshShell.AppActivate "MICROSOFT EXCEL"

      > WScript.Sleep 1000

      > WshShell.SendKeys "{TAB}"

      > WScript.Sleep 300

      > WshShell.SendKeys "{F2}"

      > WScript.Sleep 300

      > WshShell.SendKeys "{END}"

      > WScript.Sleep 300

      > WshShell.SendKeys "+{Home}"

      > WScript.Sleep 300

      > WshShell.SendKeys "^(c)"

      > WScript.Sleep 400

      > WshShell.AppActivate "MICRO KEY"

      > WScript.Sleep 400

      > Clipboard.SetText

      > WshShell.SendKeys.Send("^{v}")

      > Next

      > WScript.Quit

      > thanks in return!!!!!!!!!!!!!!!!

      #1; Fri, 23 May 2008 00:02:00 GMT
    • myRange =3D Worksheets("Sheet1").Range("A1:B1")

      myOtherRange =3D Worksheets("Sheet1").Range("A3:B3")

      myRange.Copy

      myOtherRange.Paste

      hope this helps...... i have no idea what you're doing with the

      other code...... :)

      susan

      On May 1, 11:36=A0am, staciedaisy

      <stacieda....excel.todaysummary.com.discussions.microsoft.com> wrote:

      > pretty much i am needing to know how to paste the clipboard as a macro

      >

      > "staciedaisy" wrote:

      > > I am getting an error message

      > > error: object required: 'clipboard'

      > > code: 800a01a8

      > > i am trying to paste the clipboard as key stokes, and not just pasting d=ata.

      > > this is my first script, and i learned this yesterday, so please be nice= as

      > > i am a very newbie!!!

      > > Set WshShell =3D WScript.CreateObject("WScript.Shell")

      > > For a =3D 1 To 1

      > > WshShell.AppActivate "MICROSOFT EXCEL"

      > > WScript.Sleep 300

      > > WshShell.SendKeys "{F2}"

      > > WScript.Sleep 300

      > > WshShell.SendKeys "{END}"

      > > WScript.Sleep 300

      > > WshShell.SendKeys "+{Home}"

      > > WScript.Sleep 300

      > > WshShell.SendKeys "^(c)"

      > > WScript.Sleep 400

      > > WshShell.AppActivate "MICRO KEY"

      > > WScript.Sleep 1000

      > > WshShell.SendKeys "{F2}"

      > > WScript.Sleep 2000

      > > WshShell.SendKeys "^(v)"

      > > WScript.Sleep 4000

      > > WshShell.SendKeys "~"

      > > WScript.Sleep 1000

      > > WshShell.SendKeys "%(Q)"

      > > WScript.Sleep 300

      > > WshShell.SendKeys "(R)"

      > > WScript.Sleep 300

      > > WshShell.SendKeys "(U)"

      > > WScript.Sleep 4000

      > > WshShell.SendKeys "^{INSERT}"

      > > WScript.Sleep 300

      > > WshShell.SendKeys "+{TAB}"

      > > WScript.Sleep 300

      > > WshShell.SendKeys "+{TAB}"

      > > WScript.Sleep 300

      > > WshShell.SendKeys "+{TAB}"

      > > WScript.Sleep 1000

      > > WshShell.AppActivate "MICROSOFT EXCEL"

      > > WScript.Sleep 1000

      > > WshShell.SendKeys "{TAB}"

      > > WScript.Sleep 300

      > > WshShell.SendKeys "{F2}"

      > > WScript.Sleep 300

      > > WshShell.SendKeys "{END}"

      > > WScript.Sleep 300

      > > WshShell.SendKeys "+{Home}"

      > > WScript.Sleep 300

      > > WshShell.SendKeys "^(c)"

      > > WScript.Sleep 400

      > > WshShell.AppActivate "MICRO KEY"

      > > WScript.Sleep 400

      > > Clipboard.SetText

      > > WshShell.SendKeys.Send("^{v}")

      > > Next

      > > WScript.Quit

      > > thanks in return!!!!!!!!!!!!!!!!- Hide quoted text -

      > - Show quoted text -

      #2; Fri, 23 May 2008 00:03:00 GMT
    • here is a better explanation of what i'm needing!

      i am trying to copy from excel and paste the clipboard as key stokes (like a

      macro), and not just pasting data.

      this is my first script, and i learned this 2 days ago, so please be nice as

      i am a very newbie!!!

      Set WshShell = WScript.CreateObject("WScript.Shell")

      For a = 1 To 1

      WshShell.AppActivate "MICROSOFT EXCEL"

      WScript.Sleep 300

      WshShell.SendKeys "{F2}"

      WScript.Sleep 300

      WshShell.SendKeys "{END}"

      WScript.Sleep 300

      WshShell.SendKeys "+{Home}"

      WScript.Sleep 300

      WshShell.SendKeys "^(c)"

      WScript.Sleep 400

      WshShell.AppActivate "MICRO KEY"

      WScript.Sleep 1000

      WshShell.SendKeys "{F2}"

      WScript.Sleep 2000

      WshShell.SendKeys "^(v)"

      WScript.Sleep 4000

      WshShell.SendKeys "~"

      WScript.Sleep 1000

      WshShell.SendKeys "%(Q)"

      WScript.Sleep 300

      WshShell.SendKeys "(R)"

      WScript.Sleep 300

      WshShell.SendKeys "(U)"

      WScript.Sleep 4000

      WshShell.SendKeys "^{INSERT}"

      WScript.Sleep 300

      WshShell.SendKeys "+{TAB}"

      WScript.Sleep 300

      WshShell.SendKeys "+{TAB}"

      WScript.Sleep 300

      WshShell.SendKeys "+{TAB}"

      WScript.Sleep 1000

      WshShell.AppActivate "MICROSOFT EXCEL"

      WScript.Sleep 1000

      WshShell.SendKeys "{TAB}"

      WScript.Sleep 300

      WshShell.SendKeys "{F2}"

      WScript.Sleep 300

      WshShell.SendKeys "{END}"

      WScript.Sleep 300

      WshShell.SendKeys "+{Home}"

      WScript.Sleep 300

      WshShell.SendKeys "^(c)"

      WScript.Sleep 400

      WshShell.AppActivate "MICRO KEY"

      WScript.Sleep 400

      Next

      WScript.Quit

      so after

      WshShell.AppActivate "MICRO KEY"

      WScript.Sleep 400

      i am needing to know how to paste the contents of the clipboard as

      keystrokes as if someone was actually typing the contents of the clipboard

      out.

      i am needing this done like this because the other application it is pasting

      into has drop down boxes which you can type into to select but not paste!

      any input would be greatly appreciated!!!!

      thanks soo much!

      thanks in return!!!!!!!!!!!!!!!!

      "Susan" wrote:

      > myRange = Worksheets("Sheet1").Range("A1:B1")

      > myOtherRange = Worksheets("Sheet1").Range("A3:B3")

      > myRange.Copy

      > myOtherRange.Paste

      > hope this helps...... i have no idea what you're doing with the

      > other code...... :)

      > susan

      >

      > On May 1, 11:36 am, staciedaisy

      > <stacieda....excel.todaysummary.com.discussions.microsoft.com> wrote:

      > > pretty much i am needing to know how to paste the clipboard as a macro

      > >

      > >

      > >

      > > "staciedaisy" wrote:

      > >

      > > > I am getting an error message

      > > > error: object required: 'clipboard'

      > > > code: 800a01a8

      > >

      > > > i am trying to paste the clipboard as key stokes, and not just pasting data.

      > > > this is my first script, and i learned this yesterday, so please be nice as

      > > > i am a very newbie!!!

      > >

      > > > Set WshShell = WScript.CreateObject("WScript.Shell")

      > > > For a = 1 To 1

      > > > WshShell.AppActivate "MICROSOFT EXCEL"

      > > > WScript.Sleep 300

      > > > WshShell.SendKeys "{F2}"

      > > > WScript.Sleep 300

      > > > WshShell.SendKeys "{END}"

      > > > WScript.Sleep 300

      > > > WshShell.SendKeys "+{Home}"

      > > > WScript.Sleep 300

      > > > WshShell.SendKeys "^(c)"

      > > > WScript.Sleep 400

      > > > WshShell.AppActivate "MICRO KEY"

      > > > WScript.Sleep 1000

      > > > WshShell.SendKeys "{F2}"

      > > > WScript.Sleep 2000

      > > > WshShell.SendKeys "^(v)"

      > > > WScript.Sleep 4000

      > > > WshShell.SendKeys "~"

      > > > WScript.Sleep 1000

      > > > WshShell.SendKeys "%(Q)"

      > > > WScript.Sleep 300

      > > > WshShell.SendKeys "(R)"

      > > > WScript.Sleep 300

      > > > WshShell.SendKeys "(U)"

      > > > WScript.Sleep 4000

      > > > WshShell.SendKeys "^{INSERT}"

      > > > WScript.Sleep 300

      > > > WshShell.SendKeys "+{TAB}"

      > > > WScript.Sleep 300

      > > > WshShell.SendKeys "+{TAB}"

      > > > WScript.Sleep 300

      > > > WshShell.SendKeys "+{TAB}"

      > > > WScript.Sleep 1000

      > > > WshShell.AppActivate "MICROSOFT EXCEL"

      > > > WScript.Sleep 1000

      > > > WshShell.SendKeys "{TAB}"

      > > > WScript.Sleep 300

      > > > WshShell.SendKeys "{F2}"

      > > > WScript.Sleep 300

      > > > WshShell.SendKeys "{END}"

      > > > WScript.Sleep 300

      > > > WshShell.SendKeys "+{Home}"

      > > > WScript.Sleep 300

      > > > WshShell.SendKeys "^(c)"

      > > > WScript.Sleep 400

      > > > WshShell.AppActivate "MICRO KEY"

      > > > WScript.Sleep 400

      > > > Clipboard.SetText

      > > > WshShell.SendKeys.Send("^{v}")

      > > > Next

      > > > WScript.Quit

      > >

      > > > thanks in return!!!!!!!!!!!!!!!!- Hide quoted text -

      > >

      > > - Show quoted text -

      >

      #3; Fri, 23 May 2008 00:04:00 GMT
    • Option Explicit

      Sub do_paste()

      Dim myRange As Range

      Dim myOtherRange As Range

      Set myRange =3D Worksheets("Sheet1").Range("A1:B1")

      Set myOtherRange =3D Worksheets("Sheet2").Range("A3:B3")

      myRange.Copy

      myOtherRange.PasteSpecial xlPasteAll

      Application.CutCopyMode =3D False

      End Sub

      this is the whole code. i have trouble getting "paste" to work so

      find .PasteSpecial xlPasteAll does the same thing.

      :)

      susan

      On May 1, 12:08=A0pm, Susan <bogenex....excel.todaysummary.com.aol.com> wrote:

      > myRange =3D Worksheets("Sheet1").Range("A1:B1")

      > myOtherRange =3D Worksheets("Sheet1").Range("A3:B3")

      > myRange.Copy

      > myOtherRange.Paste

      > hope this helps...... i have no idea what you're doing with the

      > other code...... :)

      > susan

      > On May 1, 11:36=A0am, staciedaisy

      >

      > <stacieda....excel.todaysummary.com.discussions.microsoft.com> wrote:

      > > pretty much i am needing to know how to paste the clipboard as a macro

      > > "staciedaisy" wrote:

      > > > I am getting an error message

      <snip>

      > > > thanks in return!!!!!!!!!!!!!!!!- Hide quoted text -

      > > - Show quoted text -- Hide quoted text -

      > - Show quoted text -

      #4; Fri, 23 May 2008 00:05:00 GMT
    • sorry, can't help you with that. ignore my other full-code post.

      :)

      susan

      On May 1, 12:19=A0pm, staciedaisy

      <stacieda....excel.todaysummary.com.discussions.microsoft.com> wrote:

      > here is a better explanation of what i'm needing!

      > i am trying to copy from excel and paste the clipboard as key stokes (like= a

      > macro), and not just pasting data.

      > this is my first script, and i learned this 2 days ago, so please be nice =as

      > i am a very newbie!!!

      > Set WshShell =3D WScript.CreateObject("WScript.Shell")

      > For a =3D 1 To 1

      > WshShell.AppActivate "MICROSOFT EXCEL"

      > WScript.Sleep 300

      > WshShell.SendKeys "{F2}"

      > WScript.Sleep 300

      > WshShell.SendKeys "{END}"

      > WScript.Sleep 300

      > WshShell.SendKeys "+{Home}"

      > WScript.Sleep 300

      > WshShell.SendKeys "^(c)"

      > WScript.Sleep 400

      > WshShell.AppActivate "MICRO KEY"

      > WScript.Sleep 1000

      > WshShell.SendKeys "{F2}"

      > WScript.Sleep 2000

      > WshShell.SendKeys "^(v)"

      > WScript.Sleep 4000

      > WshShell.SendKeys "~"

      > WScript.Sleep 1000

      > WshShell.SendKeys "%(Q)"

      > WScript.Sleep 300

      > WshShell.SendKeys "(R)"

      > WScript.Sleep 300

      > WshShell.SendKeys "(U)"

      > WScript.Sleep 4000

      > WshShell.SendKeys "^{INSERT}"

      > WScript.Sleep 300

      > WshShell.SendKeys "+{TAB}"

      > WScript.Sleep 300

      > WshShell.SendKeys "+{TAB}"

      > WScript.Sleep 300

      > WshShell.SendKeys "+{TAB}"

      > WScript.Sleep 1000

      > WshShell.AppActivate "MICROSOFT EXCEL"

      > WScript.Sleep 1000

      > WshShell.SendKeys "{TAB}"

      > WScript.Sleep 300

      > WshShell.SendKeys "{F2}"

      > WScript.Sleep 300

      > WshShell.SendKeys "{END}"

      > WScript.Sleep 300

      > WshShell.SendKeys "+{Home}"

      > WScript.Sleep 300

      > WshShell.SendKeys "^(c)"

      > WScript.Sleep 400

      > WshShell.AppActivate "MICRO KEY"

      > WScript.Sleep 400

      > Next

      > WScript.Quit

      > so after

      > WshShell.AppActivate "MICRO KEY"

      > WScript.Sleep 400

      > i am needing to know how to paste the contents of the clipboard as

      > keystrokes as if someone was actually typing the contents of the clipboard=

      > out. =A0

      > i am needing this done like this because the other application it is pasti=ng

      > into has drop down boxes which you can type into to select but not paste!

      > any input would be greatly appreciated!!!!

      > thanks soo much!

      > thanks in return!!!!!!!!!!!!!!!!

      >

      > "Susan" wrote:

      > > myRange =3D Worksheets("Sheet1").Range("A1:B1")

      > > myOtherRange =3D Worksheets("Sheet1").Range("A3:B3")

      > > myRange.Copy

      > > myOtherRange.Paste

      > > hope this helps...... i have no idea what you're doing with the

      > > other code...... :)

      > > susan

      > > On May 1, 11:36 am, staciedaisy

      > > <stacieda....excel.todaysummary.com.discussions.microsoft.com> wrote:

      > > > pretty much i am needing to know how to paste the clipboard as a macro=

      > > > "staciedaisy" wrote:

      > > > > I am getting an error message

      > > > > error: object required: 'clipboard'

      > > > > code: 800a01a8

      > > > > i am trying to paste the clipboard as key stokes, and not just pasti=ng data.

      > > > > this is my first script, and i learned this yesterday, so please be =nice as

      > > > > i am a very newbie!!!

      > > > > Set WshShell =3D WScript.CreateObject("WScript.Shell")

      > > > > For a =3D 1 To 1

      > > > > WshShell.AppActivate "MICROSOFT EXCEL"

      > > > > WScript.Sleep 300

      > > > > WshShell.SendKeys "{F2}"

      > > > > WScript.Sleep 300

      > > > > WshShell.SendKeys "{END}"

      > > > > WScript.Sleep 300

      > > > > WshShell.SendKeys "+{Home}"

      > > > > WScript.Sleep 300

      > > > > WshShell.SendKeys "^(c)"

      > > > > WScript.Sleep 400

      > > > > WshShell.AppActivate "MICRO KEY"

      > > > > WScript.Sleep 1000

      > > > > WshShell.SendKeys "{F2}"

      > > > > WScript.Sleep 2000

      > > > > WshShell.SendKeys "^(v)"

      > > > > WScript.Sleep 4000

      > > > > WshShell.SendKeys "~"

      > > > > WScript.Sleep 1000

      > > > > WshShell.SendKeys "%(Q)"

      > > > > WScript.Sleep 300

      > > > > WshShell.SendKeys "(R)"

      > > > > WScript.Sleep 300

      > > > > WshShell.SendKeys "(U)"

      > > > > WScript.Sleep 4000

      > > > > WshShell.SendKeys "^{INSERT}"

      > > > > WScript.Sleep 300

      > > > > WshShell.SendKeys "+{TAB}"

      > > > > WScript.Sleep 300

      > > > > WshShell.SendKeys "+{TAB}"

      > > > > WScript.Sleep 300

      > > > > WshShell.SendKeys "+{TAB}"

      > > > > WScript.Sleep 1000

      > > > > WshShell.AppActivate "MICROSOFT EXCEL"

      > > > > WScript.Sleep 1000

      > > > > WshShell.SendKeys "{TAB}"

      > > > > WScript.Sleep 300

      > > > > WshShell.SendKeys "{F2}"

      > > > > WScript.Sleep 300

      > > > > WshShell.SendKeys "{END}"

      > > > > WScript.Sleep 300

      > > > > WshShell.SendKeys "+{Home}"

      > > > > WScript.Sleep 300

      > > > > WshShell.SendKeys "^(c)"

      > > > > WScript.Sleep 400

      > > > > WshShell.AppActivate "MICRO KEY"

      > > > > WScript.Sleep 400

      > > > > Clipboard.SetText

      > > > > WshShell.SendKeys.Send("^{v}")

      > > > > Next

      > > > > WScript.Quit

      > > > > thanks in return!!!!!!!!!!!!!!!!- Hide quoted text -

      > > > - Show quoted text -- Hide quoted text -

      > - Show quoted text -

      #5; Fri, 23 May 2008 00:06:00 GMT