Runtime error 5

Runtime error 5



I am on Day one in learning Excel Macros. As per the tutorial I recorded the macros and tried to run it. (I have used the same file that they have provided in the tutorial and it is a .csv file)



But it showing me the following Error



Runtime Error



Invalid Procedure call or Argument



When I tried to debug it is showing as follows:



Code



Need Help



-Thanks





superuser.com/questions/846166/… You can set the CommandType property only if the value of the QueryType property for the query table or PivotTable cache is xlOLEDBQuery. Is yours xlOLEDBQuery? Can you share the tutorial link? I guess if it works in the tutorial......
– QHarr
Aug 25 at 15:21






I am not sure about the query that you are asking as I am completely Novice in this. Here is the link of the tutorial guru99.com/introduction-to-macros-in-excel.html
– Sree
Aug 26 at 13:05





What happens if you remove that line? Or comment out by placing ' in front of it.
– QHarr
Aug 26 at 13:10





1 Answer
1



You can set the CommandType property only if the value of the QueryType property for the query table or PivotTable cache is xlOLEDBQuery, which is enum 5.



This is not the case for your query. In fact, that line doesn't even exist in the source code. Perhaps you attempted to merge scripts? If so, be careful when merging connection code that the types are the same.



If you add in a debug line to get the QueryType


Debug.Print .QueryType
.Name = "receipts"



you will get the enum 6 back. You can look this up using the object explorer:



querytype



As would be expected from the connection specification:


ActiveSheet.QueryTables.Add(Connection:="TEXT;






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

How do I collapse sections of code in Visual Studio Code for Windows?

ャフサォクコ ケウ,コ,ワ メ,ロスョノ゙,クネ,フムカヤヲニ,エコ゚ツ ウイオン゙ケワサネォキモュキォウイノンコチ゚メヌナイゥフュ,カヒウネェ ネ,ホノケ,ムュキ ッボーミュハ,チ ツス ィ メウイマヤ,゙ウチ ヅ ロ,ォジヌェ ャヌット ェ,マャ,チナエヒネソキツテ トホヲヲミーァ