Showing posts with label excel. Show all posts
Showing posts with label excel. Show all posts

Tuesday, January 08, 2019

Turn off time grouping in PivotTables in Excel for Windows

https://support.office.com/en-us/article/turn-off-time-grouping-in-pivottables-in-excel-for-windows-6be5afed-348c-4db2-9f87-5ac262d67b3f?ui=en-US&rs=en-US&ad=US

To turn off time grouping on PivotTables (including data model PivotTables) and Pivot Charts, follow these instructions for adding a new DWORD (32-bit) Value registry key. The new key is: HKEY_CURRENT_USER > Software > Microsoft > Office > 16.0 > Excel > Options > DateAutoGroupingDisabled.

Monday, February 27, 2017

Excel 2013 error; [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

Based on your description, your Windows system is 64-bit and your Office is 32-bit.

I suggest you refer to this support article first:
https://msdn.microsoft.com/en-us/library/ms712362(v=vs.85).aspx

As the article said: To manage a data source that connects to a 32-bit driver under 64-bit platform, use :\windows\sysWOW64\odbcad32.exe.
To manage a data source that connects to a 64-bit driver, use :\windows\system32\odbcad32.exe.

Make sure that you create your ODBC link using the 32 bits ODBC Manager: C:\Windows\SysWOW64\odbcad32.exe
Source...

Saturday, February 04, 2017

VBA Excel - Using CreateObject

There are some very useful libaries that are not part of Excel VBA.
These include the Dictionary, Database objects, Outlook VBA objects, Word VBA objects and so on.

These are written using COM interfaces.
The beauty of COM is that was can easily use these libraries in our projects.

If we add a reference to the library we create the object in the normal way.

' Select Tools->References and place a check
' beside "Microsoft Scripting Runtime"
Dim dict As New Scripting.Dictionary

If we don’t use a reference we can create the object at run time using CreateObject.

Dim dict As Object
Set dict = CreateObject("Scripting.Dictionary")

The first method is referred to as Early Binding and the second is referred to as Late Binding(see Early versus Late Binding) for more details.

http://excelmacromastery.com/vba-objects/#Subtle_Differences_of_Dim_Versus_Set

Saturday, January 04, 2014

VB function : Clean Up / Remove HTML XML code from String

This function is removing all HTML/XML code from some string.
Private Function CodeClean(ByVal DStr As String) As String
Dim i As Long, j As Long
Dim Chr1 As String, Chr2 As String
Dim FlBol As Boolean
  Chr1 = "<"
  Chr2 = ">"

  If InStr(DStr, Chr1) > 0 Then FlBol = True Else FlBol = False
 
  Do Until FlBol = False
    i = 0
    j = 0
    i = InStr(DStr, Chr1)
    j = InStr(DStr, Chr2)
    If i > 0 And j = 0 Then
      j = Len(DStr)
    End If
    DStr = Left(DStr, i - 1) & Right(DStr, Len(DStr) - j)
    If InStr(DStr, Chr1) > 0 Then FlBol = True Else FlBol = False
  Loop
  Code Clean = DStr
End Function

You may change variables Chr1 & Chr2 to fit your need.

Saturday, December 28, 2013

Crack Hacking Password Microsoft Excel Macro VBA Project

There is another (somewhat easier) solution, without the size problems. I used this approach today (on a 2003 XLS file, using Excel 2007) and was successful.

  1.     Backup the xls file
  2.     Using a HEX editor, locate the DPB=... part
  3.     Change the DPB=... string to DPx=...
  4.     Open the xls file in Excel
  5.     Open the VBA editor (ALT+F11)
  6.     the magic: Excel discovers an invalid key (DPx) and asks whether you want to continue loading the project (basically ignoring the protection)
  7.     You will be able to overwrite the password, so change it to something you can remember
  8.     Save the xls file*
  9.     Close and reopen the document and work your VBA magic!

*NOTE: Be sure that you have changed the password to a new value, otherwise the next time you open the spreadsheet Excel will report errors (Unexpected Error), then when you access the list of VBA modules you will now see the names of the source modules but receive another error when trying to open forms/code/etc. To remedy this, go back to the VBA Project Properties and set the password to a new value. Save and re-open the Excel document and you should be good to go!

http://stackoverflow.com/questions/1026483/is-there-a-way-to-crack-the-password-on-an-excel-vba-project

My personal Note : Those methods written above is not applicable for .xlsm file. The easiest way is "save as" the file into old version .xls file. After that follow the methods above.