header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
excel doesn't save txt to xml - please help a newbe
Last Post 04 May 2011 04:01 PM by Poshoholic. 1 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
ChrisFUser is Offline
New Member
New Member
Posts:1
Avatar

--
04 May 2011 04:37 AM
    hello together,  I've got a little problem with a shell I'm writing at the moment and I hope someone of you can give me a hand, cause it is my first script. I tried to get the size of directories into a .txt-file with a batch - no problems 

    Today my boss told me, that it would be great to get these informations out of txt into an excel table. I looked around a bit, found the powershell and tryed to write a possible script for this and most functions are working... but excel doesn't save the file... not as txt and also not as a xml. 

    what coul be my prob? It would be great if someone could help me. 


    here the code: 

    if($excel){   
       $excel.Application.DisplayAlerts = $false
       $excel.quit()

       $ExcelProcess=get-process excel
       $ExcelProcess | foreach {stop-process ($_.id)} 
       [System.Runtime.Interopservices.Marshal]::ReleaseComObject($excel) | out-null
      } 

    $xlo=New-Object -comobject excel.application
    $xlo.visible=$true
    $xlo.Workbooks.OpenText("directory\test_old.csv")  

    start-sleep 4  

    $file=("directory\test.xlsx")
    $workbook.SaveAs($file)
    $excel.DisplayAlerts = $False

    $excel.quit()
    $ExcelProcess=get-process excel
    $ExcelProcess | foreach {stop-process ($_.id)}
    [System.Runtime.Interopservices.Marshal]::ReleaseComObject($excel)




     thx a lot 

    Chriz
    PoshoholicUser is Offline
    PowerShell MVP, Community Director
    Basic Member
    Basic Member
    Posts:111
    Avatar

    --
    04 May 2011 04:01 PM
    Hello,

    This forum is for community announcements and assistance with the community site only.  It is not for general PowerShell questions.  Please post your question in one of the general PowerShell forums.

    Thank you,
    Kirk Munro [MVP]
    Poshoholic

    My blog: http://poshoholic.com
    Follow me on Twitter: http://twitter.com/poshoholic
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer