T
tmwilkin
I am copying text from a web page, then pasting it into an Excel file. The
below code gets the job done using SENDKEYS and activesheet.paste. However,
depending on the computer I'm using, activesheet.paste does not work ALL the
time (usually the first time it errors out, then subsequent times it's ok).
I am trying to find a better way to paste the data. Paste special doesn't
give me many options (I tried paste as text, but it crashed Excel).
Additionally, if anyone knows of a way to bring Excel to the front again in a
more effective manner than <Alt-Tab> through sendkeys, that would be
appreciated as well.
Here is the code:
Sheets("Data").Select
Range("B:E").ClearContents
SendKeys "^(a)", False
SendKeys "^(c)", False
Application.Wait (Now + TimeValue("0:00:01"))
SendKeys "%({TAB})", False
Range("B1").Select
ActiveSheet.Paste
below code gets the job done using SENDKEYS and activesheet.paste. However,
depending on the computer I'm using, activesheet.paste does not work ALL the
time (usually the first time it errors out, then subsequent times it's ok).
I am trying to find a better way to paste the data. Paste special doesn't
give me many options (I tried paste as text, but it crashed Excel).
Additionally, if anyone knows of a way to bring Excel to the front again in a
more effective manner than <Alt-Tab> through sendkeys, that would be
appreciated as well.
Here is the code:
Sheets("Data").Select
Range("B:E").ClearContents
SendKeys "^(a)", False
SendKeys "^(c)", False
Application.Wait (Now + TimeValue("0:00:01"))
SendKeys "%({TAB})", False
Range("B1").Select
ActiveSheet.Paste