Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I think this forum rocks it has saved my bacon many many times..."

Geography

Where in the world do Tek-Tips members come from?
Kazendar (Programmer)
31 Oct 08 4:55
  I need solving for error at line 13, besides there are two warning/notes. The script is running but with these fails.

#   xls_test.ps1

function Invoke() {
  param([object]$m,
        [string]$method,
        $parameters)

  $m.PSBase.GetType().InvokeMember($method, `
    [Reflection.BindingFlags]::InvokeMethod, `
    $null, $m, $parameters,$ciUS)
}

$ciUS = [System.Globalization.CultureInfo]'en-US'

$objExcel = New-object -comObject Excel.Application
$objExcel.visible = $True
$objWorkbook = Invoke $objExcel.Workbooks Add
$objWorksheet = $objWorkbook.worksheets | where {$_.name -eq "sheet1"}

$objWorksheet.cells.item(1,1).formulaLocal = "Value in cell A1"

[void]$objWorksheet.range("a1").addComment()
[void]$objWorksheet.range("a1").comment.visible = "$False ..."
## No text found in comment !

$range = $objWorksheet.activeCell.entireColumn
$range.autoFit
## nothing has changed !

$range = $objWorksheet.range("b1:b1")
$range.cells = "ColB Row1"
$range.font.size = 24
## Property 'size' cannot be found on this object;
## make sure it exists and is settable. `
## At C:\scripts\xls_test.ps1:32 char:13 + $range.font.s <<<< ize = 24

Invoke $objWorkbook SaveAs "c:\scripts\XLS_test.xls" > $null
Invoke $objWorkbook Close 0 > $null
$objExcel.quit()
 
crobin1 (MIS)
4 Nov 08 17:19
What version of Excel are you using? When I run this against Excel 2007 the $range.autofit doesn't do anything (which I haven't investigated) but the $range.font.size does correctly change the size to 24 point.
Kazendar (Programmer)
5 Nov 08 6:37
Hi crobin1, i am using Excel 2007, and the error is still :

Property 'size' cannot be found on this object; make sure it exists and is settable. ............. etc
 

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close