How to use Excel workbook.saveas with automatic overwrite

excelObject.DisplayAlerts = False

Set excelObject = CreateObject("Excel.Application")    
excelObject.DisplayAlerts = False
Set wb = excelObject.Workbooks.Add
fullFilePath = importFolderPath & "\" & "A.xlsx"

wb.SaveAs fullFilePath, AccessMode:=xlExclusive,ConflictResolution:=Excel.XlSaveConflictResolution.xlLocalSessionChanges    
wb.Close (True)

 

 

 

https://stackoverflow.com/questions/14634453/how-to-use-workbook-saveas-with-automatic-overwrite

How to get the current product version in C#

How to get the current product version in C#

 

https://stackoverflow.com/questions/6493715/how-to-get-the-current-product-version-in-c#

VersionNumber = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

[assembly: AssemblyVersion(“1.0.2.0”)] //this the place to update the version

Fie AssemblyInfo.cs

using System.Reflection;

using System.Runtime.CompilerServices;

using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following

// set of attributes. Change these attribute values to modify the information

// associated with an assembly.

[assembly: AssemblyTitle(“Listener_1”)]

[assembly: AssemblyDescription(“”)]

[assembly: AssemblyConfiguration(“”)]

[assembly: AssemblyCompany(“Clal Insurance”)]

[assembly: AssemblyProduct(“Listener_1”)]

[assembly: AssemblyCopyright(“Copyright © Clal Insurance 2015”)]

[assembly: AssemblyTrademark(“”)]

[assembly: AssemblyCulture(“”)]

// Setting ComVisible to false makes the types in this assembly not visible

// to COM components. If you need to access a type in this assembly from

// COM, set the ComVisible attribute to true on that type.

[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM

[assembly: Guid(“3e814d74-a336-4a5e-bd6c-0162898c3045”)]

// Version information for an assembly consists of the following four values:

//

// Major Version

// Minor Version

// Build Number

// Revision

//

// You can specify all the values or you can default the Build and Revision Numbers

// by using the ‘*’ as shown below:

// [assembly: AssemblyVersion(“1.0.*”)]

[assembly: AssemblyVersion(“1.0.2.0”)]    //////////// HERE YOU UPDATE THE VERSION

[assembly: AssemblyFileVersion(“1.0.2.0”)]

 

Run c# program In Jenkins, cannot save Excel files

Usually get this error:

System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Excel cannot open or save any more documents

After SaveAs method

 

to solve this problem do this works:

  1. Create directory “C:\Windows\SysWOW64\config\systemprofile\Desktop ” (for 64 bit Windows) or “C:\Windows\System32\config\systemprofile\Desktop ” (for 32 bit Windows)
  2. Set Full control permissions for directory Desktop (for example in Win7 & IIS 7 & DefaultAppPool set permissions for user
    “IIS AppPool\DefaultAppPool”

 

See here foe more details:

 

Exclude comments when searching in Visual Studio

Exclude comments when searching in Visual Studio

Shotly:

use regular this expression –

^~(:b*//).*your_search_term

  • ^ from beginning of line
  • ~( NOT the following
  • :b* any number of white spaces, followed by
  • // the comment start
  • ) end of NOT
  • .* any character may appear before
  • your_search_term your search term 🙂

 

How to add xml-stylesheet tags to an XML file using C#

http://stackoverflow.com/questions/2145736/how-to-add-xml-stylesheet-tags-to-an-xml-file-using-c

XmlDocument doc = new XmlDocument();
    doc.AppendChild(doc.CreateProcessingInstruction(
        "xml-stylesheet", 
        "type='text/xsl' href='xslFile.xslt'"));


- OR - 

http://stackoverflow.com/questions/1845699/cadd-xsl-reference-in-xmldocument

XmlDocument xDoc = new XmlDocument();
XmlProcessingInstruction pi = xDoc.CreateProcessingInstruction(
    "xml-stylesheet", 
    "type=\"text/xsl\" href=\"cdcatalog.xsl\"");
xDoc.AppendChild(pi);
 

MS Script Debugger missing – solved

When installing QTP/UFT you select to install Microsoft Script Debugger.

Now MS removed it from their site.

see here for solution (download and install it manually)

http://www.learnqtp.com/ms-script-debugger-error-uft/

the file name is scd10en.exe/zip so you can search for it yourself.