Hello,
I have a php script that outputs an excel sheet.The user has to download macro every time he wants to run the macro on the excel sheet.
Is there anything in php where the code downloads macro also along with the excel sheet or something like a button in excel sheet itself, clicking on which the macro runs on the excel sheet.
Any help is well appreciated.
Thanks&Regards,
Shara.
4 16052
Hello,
Please consider the query, as its important for me to solve it.
I've been trying to search for a solution through out the day, but its of no use.
Any help to solve the problem in some other way is also welcome.
Thanks&Regards,
Shara.
Hello,
I have a php script that outputs an excel sheet.The user has to download macro every time he wants to run the macro on the excel sheet.
Is there anything in php where the code downloads macro also along with the excel sheet or something like a button in excel sheet itself, clicking on which the macro runs on the excel sheet.
Any help is well appreciated.
Thanks&Regards,
Shara.
Shara,
I have a couple of questions regarding your posts.
1. Is there only one user affected in this scenario? ie. Custom report, etc? If so, an easy way to do this would be to have the user save the macro code into the PERSONAL.XLS file on the local machine(or A/D profile, etc) and assign a short-cut key to the macro. This way when the user exports the data, he/she can just use a two-key shortcut to achieve the desired result.
2. Is this a dynamic report or this a static page that is generated by a static backend? If it is a static file, then I would suggest writing the export data to a file server-side that already contains the macro and the corresponding command button. Then have the user download the file from the server after your script outputs/writes the data. *Note: Depending on network security settings, having the user download active macro content may not be a viable solution.
If this is a dynamic report that affects a substantial amount of users, then I would suggest doing research on the Excel API call. Once you get in, you should be able to execute macro code that you would escape in the php script.
Hope this helps.
Regards,
Jenkins
Hello Jenkins,
This is a dynamic report that affects a substantial amount of users.I'll try the proposed.
Thanks for your help.
Regards,
Shara.
Shara,
I have a couple of questions regarding your posts.
1. Is there only one user affected in this scenario? ie. Custom report, etc? If so, an easy way to do this would be to have the user save the macro code into the PERSONAL.XLS file on the local machine(or A/D profile, etc) and assign a short-cut key to the macro. This way when the user exports the data, he/she can just use a two-key shortcut to achieve the desired result.
2. Is this a dynamic report or this a static page that is generated by a static backend? If it is a static file, then I would suggest writing the export data to a file server-side that already contains the macro and the corresponding command button. Then have the user download the file from the server after your script outputs/writes the data. *Note: Depending on network security settings, having the user download active macro content may not be a viable solution.
If this is a dynamic report that affects a substantial amount of users, then I would suggest doing research on the Excel API call. Once you get in, you should be able to execute macro code that you would escape in the php script.
Hope this helps.
Regards,
Jenkins
Hello Jenkins,
I tried searching for excel API call and got a code like this: -
<?php
-
// set up excel
-
$excel = new COM(”excel.application”) or die(”Unable to instantiate excel”);
-
// run Excel silently, since we don’t want dialog boxes popping up in the background
-
$excel->DisplayAlerts = false;
-
// open up Excel file and select the first sheet, which contains the inputs
-
$excel->Workbooks->Open(”model.xls”);
-
$book = $excel->ActiveWorkbook;
-
$sheets = $book->Sheets;
-
$sheet = $book->Worksheets(1);
-
-
// input stuff into excel spreadsheet
-
for ($i = 0; $i < count($_POST[input]); $i++) {
-
$cell = $sheet->Cells(1, $i + 1);
-
$cell->Activate;
-
$cell->value = $input[$i];
-
}
-
-
// run macro
-
$excel->Run(”runModel”);
-
-
// save spreadsheet
-
$book->SaveAs(”model.xls”);
-
-
// quit Excel and clean up
-
$book->Close(false);
-
unset($sheets);
-
$excel->Workbooks->Close();
-
unset($book);
-
$excel->Quit;
-
unset($excel);
-
-
I modified the above code to suit my code like this -
$book = $workbook->ActiveWorkbook;
-
$sheets = $book->Sheets;
-
-
$workbook->Run("TTS_PROJECT_REPORT_MACRO.xls");
-
$book->SaveAs($filename.".xls");
-
$workbook->close();
-
I avoided calling COM as it is giving error to me.Even then the code is not working.It is giving an error saying RUN is a non-existent function.
Can you please help with this?
Any other suggestions are welcome.
Thanks&Regards,
Shara.
Hello Jenkins,
This is a dynamic report that affects a substantial amount of users.I'll try the proposed.
Thanks for your help.
Regards,
Shara.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: pmud |
last post by:
Hi,
I need to use an Excel Sheet in ASP.NET application so that the users can
enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever
the USER ENETRS needs to go to the...
|
by: saddist |
last post by:
Hello,
I have and excel sheet with fields: Name | Surname | Dept. When I execute the following code, it imports 16 empty rows + filled ones
DoCmd.TransferSpreadsheet acImport = 0,...
|
by: forrestgump |
last post by:
I am currently trying to create VBA to send a specified excel sheet to varied email sources. I currently have the code below which sends the attachment in an email to a specified source e.g....
|
by: abdulkarim |
last post by:
I have an excel project and I want to protect my spreadsheet for editing by another user except few cells. If it can be possible by using vb code then help me.
thanks
|
by: tarekz |
last post by:
I have a table on an SQL server 2005, I would like to change the value of one field to another based on an excel sheet value.
In other words, if the value in the SQL table matches the value in...
|
by: kirubagari |
last post by:
I would like to duplicate the numbers from from excel sheet 1 to excel sheet 2.Kindly help me on this.Sometime its unable to duplicate..
Sub Duplicate
Dim oDoc As Object, oSheet As Object,...
|
by: kirubagari |
last post by:
Hai experts,
How to duplicate the data from 1 excel sheet to another excel sheet 2.
Lets say
Name Voucher Value Voucher Number
lee 300.00 ...
|
by: sadhana86 |
last post by:
Hi There, I have a excel sheet which is a report, which I run in a SAP application. Now I have so many fields, below is the example of the report:
User_iD Action Info_type Sub_Info_Type ...
|
by: goodamr |
last post by:
I'm using this classic ASP code to get the data of the Excel Sheet named Sheet1:
Set conn = Server.CreateObject("ADODB.Connection")
conn.Provider = "Microsoft.ACE.OLEDB.12.0"...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |