Jump to content

Mohands

New Members
  • Posts

    1
  • Joined

  • Last visited

Mohands's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Dears , I have an issue running VBScript to convert csv to xlsx and apply formatting on it from PHP where WorkBook (WB) variable always is empty. VBScript file works fine from command line , Apache service running as Administrator. I use XAMPP 7.4.21 on windows 2016 VBScript Code: Dim file, WB With CreateObject("Excel.Application") On Error Resume Next For Each file In WScript.Arguments Set objFSO = CreateObject("Scripting.FileSystemObject") Set stdout = objFSO.GetStandardStream (1) Set stderr = objFSO.GetStandardStream (2) src_file = objFSO.GetAbsolutePathName(file) stdout.WriteLine src_file Set WB = .Workbooks.Open(src_file) if IsEmpty(WB) Then stdout.WriteLine "Yes" Else stdout.WriteLine "No" End If WB.Worksheets(1).Range("A1:H1").Interior.ColorIndex = 29 WB.Worksheets(1).Range("A1:H1").Font.ColorIndex = 2 WB.Worksheets(1).Range("A1:H1").Font.Bold = True WB.Worksheets(1).Range("A1:H1").Font.Size = 14 WB.SaveAs Replace(objFSO.GetAbsolutePathName(WB.FullName), ".csv", ".xlsx"), 51 WB.Close False Next .Quit End With PHP call : exec("cscript.exe csvToxlsx.vbs sector_19_Buildings.csv");
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.