VBA Run Time error in Excel 2013 that works well in Excel 2010 - excel-2010

I have a macro that we were using for years and worked well in Excel 2010. However, now that we upgraded to Excel 2013, it gives a run time error 9.
The following code part is highlighted after debugging it:
Sheets(1).Copy after:=Workbooks(mfname).Sheets(3)
I know already that this error has to do something with the availability of the range. The question is if there is any easy fix to this? The relevant code-snippet:
Workbooks.Add
mfname= ActiveWorkbook.Name
Workbooks.Open template
template_name = ActiveWorkbook.Name
Sheets(1).Copy after:=Workbooks(mfname).Sheets(3)
Workbooks(mfname).Activate
Sheets(1).Delete
Sheets(1).Delete
Sheets(1).Delete
lapok = Sheets.Count
Thank you for the help!

I'm no expert in VBA, but little google searching says error 9 is subscript out of range error.
This likely is from Sheets(3). I also remember excel had 3 sheets open by default in those versions. Maybe that is not the case now, and causing the problem.

Related

xlwings(0.7.0) importing UDF error

Hello,
My problem is that when i try to import an UDF in Ecxel 2013 I receive the error message can be seen on the picture. I have installed xlwings and it works except the UDF importing. Note that i used "xlwings quickstart myproject" so there is no problem with the file names and i also used the sample function so that should be fine as well
Thank you in advance for your help!
I currently don't understand why you get that error, but I should be able to tell you how you can work around it for now:
Open the file udfs.py in the xlwings package and remove the last argument on line 36, i.e. remove , ArgumentDescriptions=argdocs.
The intended functionality of that line (showing function argument description) is currently broken anyway (see here) so hopefully this will be resolved in a future version.

CSOM 2013 error: Unable to cast object of type 'System.Collections.Generic.Dictionary

I'm using this code to loop columns of a SharePoint 2013 List.
currentContext.Load(currentList.Fields);
currentContext.ExecuteQuery();
foreach (Field f in currentList.Fields) {
}
No problem with normal columns. But, when I arrive to a lookup column I have this error:
"Unable to cast object of type
'System.Collections.Generic.Dictionary`2[System.String,System.Object]'
to type 'Microsoft.SharePoint.Client.Field'."
I found for example this discussion
This issue came when we were working with TaxonomyFieldValue fields. For us changing references was not an option. This helped:
TaxonomyItem dummy = new TaxonomyItem(web.Context, null);
It will force program to load adequate libraries forcing correct type in runtime.
I had this same issue and updating the references fixed it for me. This question helped me figure it out.
I went from version 14 of "Microsoft.SharePoint.Client" and "Microsoft.SharePoint.Client.Runtime" to version 16 and no longer had the error.
Latest client download

S22.Imap.BadServerResponseException - IMAP xm003 BAD [CLIENTBUG] Command syntax error

Problem with the S22.Imap:
xm003 BAD [CLIENTBUG] Command syntax error
my Search Condition from the Example:
IEnumerable<uint> uids = client.Search(SearchCondition.SentSince(new DateTime(2015, 10, 20)));
oll other SearchCondition's work fine. Pls Help.
The problem is that S22.Imap is sending an incorrectly formatted date string in the SENTSINCE search query.
Since S22.Imap is a dead project, I would recommend switching to my open source MailKit library instead.
Hope that helps.

Error Adding HU_CREATE_GOODSMVT_RFC with delphi TSAPFunction

I'm using TSAPFunction to connect to SAP with Delphi 2009.
Everything works fine, I can use some BAPIU like (RFC_READ_TABLE, BAPI_GOODSMVT_CREATE, etc...).
I'm trying to use HU_CREATE_GOODSMVT_RFC but it doesn't work.
If I try to add functions from OCX I got this error "Could not add functions"
When I try to add it from this code :
FormClientSAP.SAPFunctionsWork.Add('HU_CREATE_GOODSMVT_RFC');
I tried with this code too :
myIFunction:=FormClientSAP.SAPFunctionsWork.Add('HU_CREATE_GOODSMVT_RFC') AS IFunction;
But my function isn't added (FormClientSAP.SAPFunctionsWork.Count = 0).
I try with and without UNICODE components.
I've checked in SAP and this BAPI is RFC enable. And from SE37 I can use it and it works fine.
Can anyone can help me to understand what is wrong?
Thanks for your help.

Issues with SWI-Prolog editor

Some time ago I was fiddling with SWI-Prolog editor, trying to get something to work, and I change some configuration settings. It didn't work so I changed it back. Now SWI-Prolog editor is not working correctly. I will load files but when I click 'consult' it will just throw this error:
consult('C:/Users/Cubearth/Documents/Prolog/'filename.pl').
and I am not able to perform queries, on the knowledge base... it just does nothing. I know that it should return:
% library(win_menu) compiled into win_menu 0.00 sec, 20,952 bytes
% library(swi_hooks) compiled into pce_swi_hooks ......... (etc, etc)
For help, use ?- help(Topic). or ?- apropos(Word).
but I am not even getting that. I tried uninstalling both prolog and the editor, but still no luck.
Any ideas on how to fix this?
In order to help, I have included the configuration dump of prolog:
Installation
C:\Program Files (x86)\SWIPrologEditor\SWIMachine.ini
C:\Users\Cubearth\AppData\Roaming\SWIPrologEditor\SWIUser.ini
C:\Users\Cubearth\AppData\Roaming\SWIPrologEditor\SWIColor.ini
[SWI]
PortableApplication=0
Verzeichnis=C:\Program Files\pl
Manual=C:\Program Files\pl\bin\doc\Manual\Contents.html
XPCE=C:\Program Files\pl\bin\doc\UserGuide\Contents.html
[Program]
InterpreterParameter=-L32M
FileExtension=.pl
[Editor]
TabWidth=2
Indent=2
Indenthelp=1
AutomaticIndent=1
FileTab=1
Linenumbering=1
BracketPair=0
CursorBehindLine=1
Author=
Encoding=0
Structure=0
[Code]
Code-Completion=1
Parameter-Hints=1
Delay=100
[Options]
ColoredConsole=1
IntegratedWindow=1
ReturnToContinue=1
TraceStopsDebugToo=1
BAKFiles=1
RemoveWriteProtection=1
FileTabsMultiline=1
Language=C:\Program Files (x86)\SWIPrologEditor\english.ini
[Browser]
UseIEinternForDocuments=1
OnlyOneBrowserWindow=0
Browser=C:\Users\Cubearth\AppData\Local\Google\Chrome\Application\chrome.exe
Title=unknown
AltKeysBrowser=
ProxyEnabled=0
ProxyIP=
ProxyPort=0
[Printer]
Left=20
Top=20
Right=20
Bottom=20
Header=#%PATH%#
Footer=##- %PAGENUM% -
Linenumbers=0
LinenumbersInMargin=1
Let me enlighten the poor lost soul that is cubearth. You should double check to see which version of swi-prolog you installed (32-bit or 64-bit), because swi-prolog editor only works with the 32-bit version. If you tried using the editor with the 64-bit version, you'll get the error described above. ^^ .
p.s. You are welcome.
Enable trace, run cmd --
?- trace. consult('C:/Users/Cubearth/Documents/Prolog/'filename.pl').

Resources