From: D. Pirate Roberts on
I use the following code in vbs to copy and paste data from one Excel cell
to another:

XLBook.Worksheets("Sheet1").Select
XLBook.Worksheets("Sheet1").Range("A1").Copy
XLBook.Worksheets("Sheet1").Range("B1").PasteSpecial

My code above does a regular paste, but I need to do a paste special that
only pastes values and number formats. I've created a macro in Excel that
does this and the vba code for it is:

Range("A1").Select
Selection.Copy
Range("B1").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
Operation:=xlNone, SkipBlanks:=False, Transpose:=False

However, the vba code above does not work in vbs. It throws an Expceted
Statement error at the first colon (:) in the PasteSpecial line. Does anyone
know how I can do this in vbs?


From: y sakuda on
"D. Pirate Roberts" <dreadpirateroberts(a)bride.com> wrote in message
news:etaUBAdyFHA.1168(a)TK2MSFTNGP15.phx.gbl...
>I use the following code in vbs to copy and paste data from one Excel cell
>to another:
>
> XLBook.Worksheets("Sheet1").Select
> XLBook.Worksheets("Sheet1").Range("A1").Copy
> XLBook.Worksheets("Sheet1").Range("B1").PasteSpecial
>
Hellow
Try this

XLBook.Worksheets("Sheet1").Range("B1").PasteSpecial -4122

Note: for -4122 search for Object browser with xlpasteformats
Y Sakuda from JPN


From: Tom Ogilvy on
XLBook.Worksheets("Sheet1").Select
XLBook.Worksheets("Sheet1").Range("A1").Copy
XLBook.Worksheets("Sheet1").Range("B1").PasteSpecial 12

--
regards,
Tom Ogilvy


"D. Pirate Roberts" <dreadpirateroberts(a)bride.com> wrote in message
news:etaUBAdyFHA.1168(a)TK2MSFTNGP15.phx.gbl...
> I use the following code in vbs to copy and paste data from one Excel cell
> to another:
>
> XLBook.Worksheets("Sheet1").Select
> XLBook.Worksheets("Sheet1").Range("A1").Copy
> XLBook.Worksheets("Sheet1").Range("B1").PasteSpecial
>
> My code above does a regular paste, but I need to do a paste special that
> only pastes values and number formats. I've created a macro in Excel that
> does this and the vba code for it is:
>
> Range("A1").Select
> Selection.Copy
> Range("B1").Select
> Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
> Operation:=xlNone, SkipBlanks:=False, Transpose:=False
>
> However, the vba code above does not work in vbs. It throws an Expceted
> Statement error at the first colon (:) in the PasteSpecial line. Does
anyone
> know how I can do this in vbs?
>
>


From: Tom Ogilvy on
? xlPasteValuesAndNumberFormats
12
? xlpasteFormats
-4122
? xlpasteValues
-4163


--
Regards,
Tom Ogilvy


"y sakuda" <sakudayasuichiro(a)hotmail.com> wrote in message
news:%23xeoqIdyFHA.3812(a)TK2MSFTNGP09.phx.gbl...
> "D. Pirate Roberts" <dreadpirateroberts(a)bride.com> wrote in message
> news:etaUBAdyFHA.1168(a)TK2MSFTNGP15.phx.gbl...
> >I use the following code in vbs to copy and paste data from one Excel
cell
> >to another:
> >
> > XLBook.Worksheets("Sheet1").Select
> > XLBook.Worksheets("Sheet1").Range("A1").Copy
> > XLBook.Worksheets("Sheet1").Range("B1").PasteSpecial
> >
> Hellow
> Try this
>
> XLBook.Worksheets("Sheet1").Range("B1").PasteSpecial -4122
>
> Note: for -4122 search for Object browser with xlpasteformats
> Y Sakuda from
JPN
>
>


From: y sakuda on
"y sakuda" <sakudayasuichiro(a)hotmail.com> wrote in message
news:%23xeoqIdyFHA.3812(a)TK2MSFTNGP09.phx.gbl...
> "D. Pirate Roberts" <dreadpirateroberts(a)bride.com> wrote in message
> news:etaUBAdyFHA.1168(a)TK2MSFTNGP15.phx.gbl...
>
> XLBook.Worksheets("Sheet1").Range("B1").PasteSpecial -4122
>
Sorry you want to Paste values and format.
I misread your post.
-4122 paste format only.
Y Sakuda from JPN