Batch file for inserting macro's

I am trying to create a batch file as icon on desktop, that would open a specific excel file, create a macro in it and copy code from a specific txt file into it. The reason i need this, is that the file is located on a server and the ending .xlm cannot be cahanged […]

Microsoft Excel cannot open or save any more documents on Unit Test

There are a lot of posts about this, but with, I have checked them, but I couldn’t find anything that worked for me. There is a test in our application that access an excel file, like this: Excel.Application _excelApp = new Excel.Application { Visible = false }; // get a new workbook _workbook = […]

Run Excel VBA sub from javascript in a secure environment

I am attempting to do some automation of excel taks using javascipt. These workbooks already have VBA modules, so I will need to be able to run them from javascript. My challenge is that when I open a workbook using Javascript I do not get prompted to enable macros. I am not able to change […]

Error when OleDB(ACE) Read the .xls file

string connStr = @”Provider=Microsoft.ACE.OLEDB.12.0;Data Source=” + path + “;Extended Properties=\”Excel 8.0;HDR=Yes;IMEX=1\”;”; OleDbConnection MyConnection; OleDbCommand MyCommand = new OleDbCommand(); MyConnection = new OleDbConnection(@connStr); MyConnection.Open(); // Here the error come… Im try to using this connStr to connect to My xls file. The problem was “External table is not in the expected format.” Im have aleady installed […]

Is it possible to select a range of data via a macro if the start and end row is variable?

I need to add a piece of code to my macro that copies and pastes a range of data. The problem that I am having is that the data can start and finish on any row. Is it possible to do this? e.g. Currently the data starts in cell C10 and ends in cell I20. […]

Php – Read Excel and Strore to Db

error_reporting(E_ALL); ini_set(‘display_errors’, TRUE); ini_set(‘display_startup_errors’, TRUE); $inputFileName =”../brief/phaseupload/” . $filename; // Read your Excel workbook try { $inputFileType = PHPExcel_IOFactory::identify($inputFileName); $objReader = PHPExcel_IOFactory::createReader($inputFileType); $objPHPExcel = $objReader->load($inputFileName); } catch(Exception $e) { die(‘Error loading file “‘.pathinfo($inputFileName,PATHINFO_BASENAME).'”: ‘.$e->getMessage()); } // Get worksheet dimensions $sheet = $objPHPExcel->getSheet(0); $highestRow = $sheet->getHighestRow(); $highestColumn = $sheet->getHighestColumn(); // Loop through each row of the […]

Excel Worksheet Saved As PDF – Print Area Changes

I have an excel worksheet and I have a macro that saves the worksheet as a PDF File to a directory on our network. When I view the Print Preview in Excel it is on 1 sheet. However when I open the PDF File it is bleeding onto a second page. It is formatting in […]

OLE.Add pdf displayed strangley

I have a macro that when i press button i can add file to document. It works fine for most files but PDF acts strangly it displays no icon and no filename and its size is like only a dot, you can resize it after but its only a blank white square. here is my […]

Remove Unicode characters from CSV files

The company I work for utilizes a MySQL database for most of its operations. Each week our vendors send us an update file in CSV format. We upload the file through our CRM software and it goes through and updates the records in our database. Ideally this works and everything finishes. It rarely is that […]

Adding image to Excel

I’m trying to insert an image from file to Excel using EPPlus and, I added the image to Excel successfully but can’t position it properly. Using img As System.Drawing.Image = Image.FromFile(path) ws.Drawings.AddPicture(“picture1”, img) ws.Drawings.Item(“picture1”).SetPosition(row, 0, column, 0) End Using That’s how I add the image, you can see the results in the image below. […]

MS Excel Spreadsheet is the best Office Software, Excel VBA and Excel Formulas make Spreadsheet work faster.