1
I want to change the icon of the excel document, to have another face and look like an executable, or something like that, can help me?
1
I want to change the icon of the excel document, to have another face and look like an executable, or something like that, can help me?
1
To change the icon just create a shortcut (e.g. desktop), click file properties (shortcut) and click the button Alterar Ícone
and choose the desired icon.
Another option would be to create a file executable to open the file already with the enabled macros:
Create a file with the following code by changing the line where you indicate which local folder the file is in and save it to the desired location (e.g. C: tmp) with extension .Cs:
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading;
using System.Windows.Forms;
static class Program
{
// variáveis de instãncia
static object oExcel = null;
static object oBooks = null;
static object oBook = null;
static object oMissing = System.Reflection.Missing.Value;
static System.Globalization.CultureInfo ci = Thread.CurrentThread.CurrentCulture;
[STAThread]
static void Main()
{
string CaminhoDoArquivo = @"C:\Caminho\Para\Seu\Arquivo\Excel\ExcelComMacros.xlsm";
if (ExcelEstaInstalado())
{
try
{
if (System.IO.File.Exists(CaminhoDoArquivo))
{
AbrirArquivo(CaminhoDoArquivo);
}
else
{
MessageBox.Show(string.Format("O arquivo {0} não foi encontrado", CaminhoDoArquivo));
}
}
catch (System.IO.IOException)
{
MessageBox.Show("Erro de acesso ao arquivo. Verifique o arquivo de configuração ou as permissões de pasta");
}
}
else
{
MessageBox.Show("Não foi possível encontrar a instalação do Microsoft Excel no seu computador");
}
Application.Exit();
}
private static void AbrirArquivo(string caminhoDoArquivo)
{
object oFileName = caminhoDoArquivo;
oExcel = Activator.CreateInstance(Type.GetTypeFromProgID("Excel.Application"));
oExcel.GetType().InvokeMember("AutomationSecurity", BindingFlags.SetProperty, null, oExcel, new object[] { 1 }, ci);
oExcel.GetType().InvokeMember("Visible", BindingFlags.SetProperty, null, oExcel, new object[] { true }, ci);
oBooks = oExcel.GetType().InvokeMember("Workbooks", BindingFlags.GetProperty, null, oExcel, null, ci);
oBook = oBooks.GetType().InvokeMember("Open", BindingFlags.InvokeMethod, null, oBooks, new object[] { oFileName, oMissing, false }, ci);
}
public static bool ExcelEstaInstalado()
{
Type officeType = Type.GetTypeFromProgID("Excel.Application");
if (officeType == null)
{
return false;
}
else
{
return true;
}
}
}
This is a language file C.
Open a prompt (Windows key + R and type CMD)
Access the folder c:\Windows\Microsoft.NET\Framework\v2.0.50727
:
cd c:\Windows\Microsoft.NET\Framework\v2.0.50727
Enter the following code:
csc.exe /target:winexe /out:"C:\Caminho\Do\Executavel\ArquivoExecutavel.exe" "C:\Caminho\Para\Arquivo\C\ScriptEmLinguagemC.cs"
Remembering to change the paths to where your files are.
Ready! You will have an executable to run your spreadsheet.
Browser other questions tagged excel vba
You are not signed in. Login or sign up in order to post.
You want to change the Excel icon?
– Leandro Felipe Moreira