|
How can I completely remove a macro from an excel spreadsheet?
I'm developing an application in C# that opens an excel spreadsheet and attempts to update the spreadsheet however, this spreadsheet contains a macro that refreshes 2 pivottables upon opening.
Since I'm trying to update the excel sheet at the same time the pivottables are refreshing, I get an error (Excel is a single-threaded application. Only one chunk of code can be executed at a time).
So I'm trying to find out how I can completely remove these macros. I went into "Tools -> Macro -> Macros" and deleted the 2 macros that were listed there however the pivottables still automatically refresh everytime the spreadsheet is opened (thus still giving me an error).
Any ideas?
Thanks in advance.
-Goalie35
|
|
|
|
|
Hello
Goalie35 wrote: this spreadsheet contains a macro that refreshes 2 pivottables upon opening.
If they only refresh the table upon opening, why not waiting until they finish their job, then make your updates?? Maybe you'd put your code in a Try/wait/Try Again pattern!!
Regards
|
|
|
|
|
Hi Nader.
Thanks for the reply.
I actually did use a delay as a temporary solution however we're trying to build our application so that it runs as quickly as possible & setting a delay would have done the opposite we were looking to accomplish.
I did find a solution to this problem however. It turns out that it wasn't the macro that was the problem. There's a pivottable option in excel under "Pivottable Options" where you can disable the refresh when excel opens. This refresh was the process that was conflicting with my application. I then refresh the pivottables in my code.
Thanks.
-Goalie35
|
|
|
|
|
I'm still learning programming.Can anyone help with a coding for a C#(othello) game.Just a simple programme that uses (X and O) for players not the one currently posted on the web cause it is more advanced for what I supposed to do now.
The board's initial setup contains 2 X's on the bottom corners of the board and
2 circles on the top corners of the board.
Player one will be circles and player two will be X's. Player one begins by
putting a circle in a square adjacent to where there is already a circle. If
there are any X's in adjoining squares to where player 1 puts the circle, those
X's become circles. Then player two does the same with X's. The game is won if
one player eliminates the other player entirely, or by having the most X's or
circles when every square on the board is filled.
|
|
|
|
|
You have gotten the game all wrong.
The game starts with two pieces of each color in the center of the board, like this:
OX<br />
XO
Each player places pieces in turn, so that they surrond one or more of the opponents pieces at both ends of a straight line, turning the surronded pieces. Like this:
XOX becomes XXX
XOOOOOX becomes XXXXXXX
A line can be formed horizontal, vertical or diagonal. One move may form several lines.
If a player can not turn any of the opponents pieces, he has to skip that move.
The game ends if all of one players pieces are eliminated, no one of the players can do a move, or when the board is full. The player having the most pieces at the end of the game wins.
The name "Othello" is owned by the company that sells the board game, so it's usually named "Reversi" as a computer game.
---
b { font-weight: normal; }
|
|
|
|
|
kgopa wrote: Infact that was a question from my lecture.
Yes, I see now that the specification is way too well written.
that's how my lecture whants it.Please help me.
What is it that you need help with, then?
---
b { font-weight: normal; }
|
|
|
|
|
how to create menu dynamically in Visual studio 2005.using MenuStrp control.
Hai
|
|
|
|
|
Hello
MenuStrip menu = new MenuStrip();
MenuItem Mi = menu.Items.Add("TestMenu");
Mi.MenuItems.Add("AnotherMenuItem");
Regards
|
|
|
|
|
I have 3 components
Component A (a scheduling engine), B (a windows service) and C (a task)
Component C implements objects of type A.
Component B creates objects of type C by reflection.
Component C needs to access a SQL Server DB but i don't understand why he cannot open a connection to the DB.
This are component A permissions
using System;<br />
using System.Reflection;<br />
using System.Runtime.CompilerServices;<br />
using System.Runtime.InteropServices;<br />
using System.Security.Permissions;<br />
using System.Data.SqlClient;<br />
using System.Net.Mail;<br />
<br />
...<br />
<br />
[assembly: SmtpPermission(SecurityAction.RequestMinimum, Unrestricted = true)]<br />
[assembly: SqlClientPermission(SecurityAction.RequestMinimum, Unrestricted = true)]<br />
[assembly: UIPermission(SecurityAction.RequestMinimum, Unrestricted = false, Window = UIPermissionWindow.AllWindows)]<br />
[assembly: IsolatedStorageFilePermission(SecurityAction.RequestMinimum, UserQuota = 1048576)]<br />
[assembly: SecurityPermission(SecurityAction.RequestMinimum, UnmanagedCode = true)]<br />
[assembly: FileIOPermission(SecurityAction.RequestOptional, Unrestricted = true)]<br />
[assembly: CLSCompliant(true)]<br />
This are component B permissions
using System;<br />
using System.Reflection;<br />
using System.Runtime.CompilerServices;<br />
using System.Runtime.InteropServices;<br />
using System.Security.Permissions;<br />
using System.Diagnostics;<br />
using System.Configuration;<br />
using System.Data.SqlClient;<br />
<br />
using Microsoft.Practices.EnterpriseLibrary.Logging;<br />
<br />
...<br />
<br />
[assembly: SqlClientPermission(SecurityAction.RequestMinimum)]<br />
[assembly: ConfigurationPermission(SecurityAction.RequestMinimum, Unrestricted = true)]<br />
[assembly: EventLogPermission(SecurityAction.RequestMinimum, PermissionAccess = System.Diagnostics.EventLogPermissionAccess.Write, Unrestricted = true)]<br />
[assembly: UIPermission(SecurityAction.RequestMinimum, Clipboard = UIPermissionClipboard.AllClipboard, Unrestricted = false, Window = UIPermissionWindow.AllWindows)]<br />
[assembly: IsolatedStorageFilePermission(SecurityAction.RequestMinimum, UserQuota = 1048576)]<br />
[assembly: SecurityPermission(SecurityAction.RequestMinimum, UnmanagedCode = true)]<br />
[assembly: FileIOPermission(SecurityAction.RequestOptional, Unrestricted = true)]<br />
[assembly: CLSCompliant(true)]<br />
This are component C permissions
<br />
using System;<br />
using System.Reflection;<br />
using System.Runtime.CompilerServices;<br />
using System.Runtime.InteropServices;<br />
using System.Security.Permissions;<br />
using System.Data.SqlClient;<br />
using System.Net.Mail;<br />
<br />
...<br />
<br />
[assembly: SmtpPermission(SecurityAction.RequestMinimum, Unrestricted = true)]<br />
[assembly: SqlClientPermission(SecurityAction.RequestRefuse, Unrestricted = true)]<br />
[assembly: IsolatedStorageFilePermission(SecurityAction.RequestMinimum, UserQuota = 1048576)]<br />
[assembly: SecurityPermission(SecurityAction.RequestRefuse, UnmanagedCode = true)]<br />
[assembly: FileIOPermission(SecurityAction.RequestOptional, Unrestricted = true)]<br />
[assembly: CLSCompliant(true)]<br />
The problem is on the C component
The method which opens a Connection call stack is:
A --> B --> C
I've also tried to create a SqlClientPermission object, add the connection string and call to the Assert method but a SecurityExeption is trowed when connection.Open() method is executed.
Any Idea?
I'm on a Fuzzy State: Between 0 an 1
|
|
|
|
|
how should i insert an image in an xml file using c# without using xsl or data sets? can u plz tell me an easy way out which also consumes less memory.....and also is picture box a good idea to show the retrieved images from the same xml file or is there any other better way to show aswell?
any help would be greatly appreciated!
bia ali
-- modified at 9:00 Thursday 24th August, 2006
|
|
|
|
|
Hello
You would use an XmlReader object to read the file into an XmlDocument object, then write it back after storing whatever you want using an XmlWriter. You can find all these classes in System.Xml namespace.
About displaying the picture, a PictureBox would be appropriate. Why not??
Regards
|
|
|
|
|
Hello everybody
Is there a way to check if there is proccess open to a certain file?
I'm trying to access a file in an app I'm writing, but one of the files might be in the middle of another process (another filesteram). is there anyway to check if there is a proccess to that file?
Thanks!
|
|
|
|
|
Hello
Open it in a try block and catch any exception.
Regards
|
|
|
|
|
Hi,
You can use FileSystemWatcher on that folder. Set the notify filter and all other necessary properties. Then when the file is completed you get OnCreated and OnChanged events. Remember that these events are fired many times for the same file also, but that wont be a problem. I, myself am using the watcher. Remember the path, notifyfilters properties. Try to search how you can attach Watcher to a folder on msdn.
If any problem i can help, if u r interested in this solution.
<marquee>"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
Thanks!
I'll try that.
|
|
|
|
|
Can someone tell me why I have no data showing in any of the rows on the datagrid's ComboBoxColumn I created. The Datagrid works fine and in the debugger I see all the items listed in my ComboBoxColumn cells but visually when I click the down arrow in each cell there is nothing showing up.
foreach (DataRelation relation in complexObject.Relations)
{
DataGridViewComboBoxColumn comboColumn = new DataGridViewComboBoxColumn();
comboColumn.Name = (string)relation.ExtendedProperties["ColumnName"];
dataGrid.Columns.Add(comboColumn);
foreach (DataRow row in relation.ParentTable.Rows)
{
DataRow[] childRows = row.GetChildRows(relation);
DataGridViewComboBoxCell newCell = new DataGridViewComboBoxCell();
foreach (DataRow childRow in childRows)
{
newCell.Items.Add(childRow.ItemArray[relation.ChildTable.Columns.IndexOf((string)relation.ExtendedProperties["ShowColumn"])]);
}
dataGrid.Rows[relation.ParentTable.Rows.IndexOf(row)].Cells[(string)relation.ExtendedProperties["ColumnName"]] = newCell;
}
}
|
|
|
|
|
hi,
how can i query an excel sheet to get a column values using c#.
thanks
|
|
|
|
|
What have you tried up to now?
Regards
Malc
*********************************************
|
|
|
|
|
my idea is to use a dataset and bind the excel sheet to it. but i am not sure about the provider or the connection strings.
Is it possible to achieve this with out using provider, i mean just like opening a file and querying.
|
|
|
|
|
i want to display the control of a webpage in a tree structure with the help of reflection in csharp in visual studio 2005 .....pls send a demo code..
|
|
|
|
|
Prodyut Pakhira wrote: pls send a demo code..
ROTFL.
No, we probably won't. It's rare for the plethora of 'I don't want to do anything, please do my work for me' posts to get a positive reply. Why don't you do your own job and post a question when you get stuck ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
By,
I want to know the lenght of audio file(like mp3 or Wav) in seconds.
What is the right way?
In the image file(like Jpg or Gif) i have used metadata with PropertyItem, there is a way like this?
Thanks.
|
|
|
|
|
Through DirectShow or WMP you can load an audio file and get it's length.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Excuseme,
It is possible to have an example?......an istance of the object and the dll to use.
Thanks.
|
|
|
|
|
I have the framework 1.1 and i can not know this data, you can help me please?
|
|
|
|