vba,vbscript,wmiRelated issues-Collection of common programming errors
MadsChristiansen
vba excel-vba
This is my first question, so please be patient:)I am not an experienced VBA programmer, and I have made my self some issues in my software.I have a program wich pastes some data in and then adds some new columns. Afterwards it splits up some text and puts it inside the cells within the new columns.The program works perfect the first time, but second time it looks like it is pasting the data in wrong. It has a different look, and the program fails when it is picking data from some cells witch ap
lfrandom
vba ms-access access-vba
I want to generate a PDF file using VBA, I found some tools but I am not sure if it supports to generate in a table format. Or is there another third party tool(free) to generate an access form in PDF format?
arcotenterprises
algorithm vba ms-access access-vba
Am trying to list out all the possible sequential (continuous and forward direction only) sum combinations , within the same subject. Listing out the row_id and the number of rows involved in the sum.Sample :Input (Source Table 🙂 DLID Subject Total 1 Science 70 2 Science 70 3 Science 70 4 Science 70 5 Maths 80 6 Maths 80 7 English 90 8 English 90 9 English 90 10 Science 75 Expected Result : ID Number of Rows Subject Total 1 1 Scie
Finch042
performance file vba networking system
This turned into a rather long post, and there’s not really an “answer” per say. I’m more looking for an explanation as opposed to some silver bullet to fix the problem. As such, any aspect you’d like to answer would be quite appreciated. Thanks in advance! I’m running into what may be a “problem” with the file system object, and that’s lead to a question about the functionality etc. of how the File System Object in VBA works vs. “something else” (I don’t know if there’s an alternative to use in
Brad
excel vba index match vlookup
I have an excel formula that I use often that does a VLookup. It has an embedded Index/Match that gives the last numeric value in the “M” Column. The Worksheet formula is this:=VLOOKUP(INDEX($M$10:$M75,MATCH(9.99999999999999E+307,$M$10:$M75)),Data,4)Cell $M75 being the cell of the row this formula is in. There are numeric, non-numeric and blank cells in Column M but the ID’s that I want are always numeric.So I am trying to write a custom function that would let me simply write =current()Here i
Nachiket Kamat
vba vb6
I have referred to code in this article to send messages from 1 C#.NET application to another C#.NET application using win32 api (SendMessage, FindWindow, WM_COPYDATA) MSDN code sample applicationMy requirement is that the target app is an VB6 application ( we have access to its source code).. I am using following code to send message to the VB6 exe application. But, how do I receive the message in VB6 application? (Following are codes in C#.NET to send/receive message)Code for sending message:-
Jeff Vanzella
collections vba type-safety vb6
Recently I decided VB6’s Collection wasn’t enough for my needs, so I decided to implement something like C#’s List<T>. Here’s the class that resulted, I’d like to know if the implementation could be made better /more efficient, especially with Insert and Sort methods; also I’d like another pair of eyes to examine the errors being raised and see if it all makes sense – the idea isn’t to throw every error that’s possible to get with a List<T>, but I might have missed throwing an error
Doc Brown
excel vba
I have a report generator in Excel VBA, which works so far. It reads some input data and produces as a formatted Excel sheet as result. The last column of this sheet is filled with some kind of free text. Now, sometimes the free text does not fit into the last column, it is just too wide. Since the row height of all rows of this report is fixed, I cannot set range.WrapText=True for this column (to let the text stay visible, one would have to increase the row height). A manual (non-VBA) solution
user1787425
excel vba filtering
I am having a problem using a filtered range in VBA. If I use a macro to filter the range, then use another to call a Subtotal worksheet function to find a minimum values in the first column, I get the expected minimum for the filtered range; this is what I want. This is shown here:Sub TestFilterTrans()Call FilterTrans(“111Wall”) End SubSub TestMinDate()MsgBox MinTransDate() End SubSub FilterTrans(Inv As String)Range(“TransLabels”).SelectSelection.AutoFilterActiveSheet.Range(“Trans”).AutoFilter
Jean-François Corbett
excel vba excel-vba
I’m trying to populate a dynamic array with data from a sheet. I get the “error 9 subscript out of range”. Why? Sub correct()Dim row As Integer, i As Long Dim constants() As Double ‘this declares the dynamic array row = 1 i = 0ReDim constans(0) ‘this resizes the array(rediminsion’s the array)Do Until ThisWorkbook.Sheets(“Deg 4”).Cells(row, 1).Value = “”constants(i) = ThisWorkbook.Sheets(“Deg 4”).Cells(row, 1).Valuei = i + 1 ‘increments array indexReDim Preserve constants(i) ‘resize the array 1 l
Sufiyan Ghori
vbscript upload ftp download
I am so confused with this, I am trying to upload data to FTP through VBS script and it works fine for a single file file but doesn’t upload multiple files when I add the script inside a loop.Also , why do we need to generate a temporary file when remote uploading to FTP,I mean to say this,this is the script I am using,Dim fso, folder, files, strPath Set fso = CreateObject(“Scripting.FileSystemObject”)strPath = “E:/Test” Set folder = fso.GetFolder(strPath) Set files = folder.FilesConst hostname
Motti
internet-explorer dom vbscript automated-tests qtp
I have rich web app btuil with ExtJS. It has multi-select list control (created with JS+CSS). I want to click on some item in that list using HP QuickTest Pro 10 with Internet Explorer 6. I added that item into Object repository and found that following code works – selects some item:Browser(“blah”).Page(“blah”).WebElement(“SomeElem”).Clicknext code also works:Browser(“blah”).Page(“blah”).WebElement(“SomeElem”).FireEvent(“onMouseDown”) Browser(“blah”).Page(“blah”).WebElement(“SomeElem”).FireEven
JustMe
vbscript md5
I need a way of natively calculate a MD5 HASH of a file in vbscript, and MD5 class has a property called GetMd5Hash which seems that can help me. I just have to read a file into a byte array and then apply this method. I found a script code in web page http://msdn.microsoft.com/en-us/library/system.security.cryptography.md5(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-2 which is exactly what I need but when I run it with command cscript /E:vbs md5.vbs if fails with error code:md5.v
Michael Petrotta
vbscript
I’m new to vbscript. I get the errorDeclaration expected at get_htmlAt the bottom part of my code. I am actually trying to declare a value (which is a url) for the variable get_html. How can I resolve this?Module Module1Sub Main()End Sub Sub get_html(ByVal up_http, ByVal down_http)Dim xmlhttp : xmlhttp = CreateObject(“msxml2.xmlhttp.3.0”)xmlhttp.open(“get”, up_http, False)xmlhttp.send()Dim fso : fso = CreateObject(“scripting.filesystemobject”)Dim newfile : newfile = fso.createtextfile(down_http,
Jared
vbscript compiler-errors runtime-error sendkeys wsh
I am getting the following error with my code in a .vbs file:C:\…\Root_VBS_Script_1.vbs(19, 1) Microsoft VBScript runtime error: Invalid or unqualified reference1 was unexpected at this time.The .vbs file is as follows:Set wshShell = CreateObject(“Wscript.Shell”)Set args = WScript.Arguments arg1 = args.Item(0)Dim filenamefilename = “”&arg1&””WshShell.SendKeys “root -b” //opens root in batch mode WshShell.SendKeys “~” WshShell.AppActivate ROOT_session WshShell.SendKeys “.x analysis.C” w
sqlchild
ms-access asp-classic vbscript access-vba
I want to read date time from ms access database .the column is of datatype DATETIME and value is : 1/27/12 5:10 PM<html> <body> <%Dim Conn Dim Rs Dim sqlDim sConnectionDim Today as Date //this gives error – unexpected end of file , i want to display current date and time ??? Set Conn = Server.CreateObject(“ADODB.Connection”) Set Rs = Server.CreateObject(“ADODB.Recordset”)filepath= Server.MapPath (“mydb.mdb”) sConnection = “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=” & fi
Bart
asp.net javascript ajax vbscript option-strict
Can you link to a specific value in an options drop down box from another page? In other words, let’s say that I’m on page 1 and I want to anchor link to page 2 that has an options drop down box with 3 different values in it. Let’s say by default when you go to page 2, the drop down option box is showing value 1. Is it possible to link to page 2 and change the value of that option box on the fly? Whereas when you click the link on page 1 it will automatically show value 3 instead of 1 on page 2.
MansoorShaikh
vbscript
Is it possible to store console logs of any IE web page in a file which I can later parse for my validation requirement?
Excellll
vba debugging dictionary vbscript breakpoints
Has anyone ever run into breakpoints in the VBA console actually introducing errors? How could this possibly happen?The short version of the story is that I have some code that works as expected when executed with no breakpoints toggled on. However, when breakpoints were toggled on in a few locations (in a subroutine and in a class method), the code would throw inexplicable errors when stepping through the code. I would ordinarily find this an extremely unlikely explanation, but after spending 2
AnnonMan
xml vbscript wix installer windows-installer
I am writing a VB script that recursively goes in to a directory and creates a WIX XML file I am getting an error The Component element contains an unexpected child element ‘Directory’. when i try to compile my WIX can someone help please.<Media Id=”1″ Cabinet=”simple.cab” EmbedCab=”yes” /><Directory Id=”TARGETDIR” Name=”SourceDir”><Directory Id=”ProgramFilesFolder” Name=”PFiles”><Directory Id=”MSI” Name=”MSI”><Component Id=”first.txt” DiskId=”1″ Guid=”*”><File I
skaffman
c# wmi adsi
I have encountered a strange situation where starting an application pool from a windows service (written in C#, set to “Automatic” startup) using WMI or ADSI immediately after the server reboots hangs. I’ll describe the issue: We are developing a large application (Windows 2003 Server SP2, IIS 6.0) which contains the following main processes (these processes are invoked & initialized using a windows service startup procedure when the application is started): 1) XServer1.exe, XServer2.exe –
lntan
winapi wmi
According to this link WMI Architecture, WMI providers consist of a DLL file and a Managed Object Format (MOF) file. Supposing that I want to query the information of the Win32_BIOS class and I know the provider of this class consist of Cimwin32.dll and Cimwin32.mof, how to query the information of this class not via Winmgmt services.
Joulukuusi
wmi
We have an application that we have instrumented with WMI, and have added a WMI method which is a ManagementTask. When we try to invoke this management task from another application the method is getting called just fine, however within that thread of execution we are trying to write to a file, send a command to the SCM, and perform debug logging. None of these three items will execute because they seem to be running into permissions problems.When we try to write to a file we get the errorEither
John Saunders
c visual-studio-2010 wmi wifi
I am trying to identify a method for obtaining nearby wifi access points using C in Windows. I am coding in Visual Studio 2010. I have read the necessary documentation but am lacking in guidance on how to implement code that would accomplish this.I am specifically interested in obtaining the MAC address of nearby access points or at a minimum the MAC address of the currently connected Wifi access point. Is it possible to do this using WMI in Windows, specifically on Windows XP SP3 and later?Any
Erik Funkenbusch
c# 64bit wmi native-code
I am working on a in-process wmi provider which loads a native third party library using[DllImport]. The dll locations is fixed to c:\mydllpath. Before loading the dll I set current directory to the dll loaction, in the provider’s Bind() method.Environment.CurrentDirectory = Environment.ExpandEnvironmentVariables(“%SystemDrive%”) + “\mydllpath”; Provider is built for ‘Any CPU’, installed using gacutil, and installexe. gacutil.exe /if myprovider.dllinstallutil.exe myprovider.dllIt is working fine
Raptor
python wmi
I am trying to execute following python code to connect to a remote machine but was hitting following error. Please let me know how to overcome this errorwmi.WMI(“10.9.19.110″,user=”username”,password=”pass”)Error:Traceback (most recent call last):File “<stdin>”, line 1, in <module>File “C:\Users\IBM_ADMIN\AppData\Roaming\Python\Python27\site-packages\wmi , line 1290, in connecthandle_com_error ()File “C:\Users\IBM_ADMIN\AppData\Roaming\Python\Python27\site-packages\wmi , line 241, i
user1803425
python python-2.7 wmi cpu temperature
Basically i want to read the cpu temperature in python. Please explain in layman’s terms as i have never done this on windows before nor have i had to work with wmi.This is what I have at the moment: import wmi w = wmi.WMI(namespace=”root\wmi”) temperature_info = w.MSAcpi_ThermalZoneTemperature()[0] print temperature_info.CurrentTemperature(i got this code from this thread: Accessing CPU temperature in python)however, on running the script, i get this error: Traceback (most recent call last):Fil
Adam Driscoll
c++ com wmi
I have created a native WMI provider following This tutorial on MSDN. My MOF for the class looks similar to this:[dynamic, provider(“CacheProvider”)] class Cache {[key]String Path;uint32 Type;uint64 MaxSize;uint64 Size;boolean Enabled; };All the data is returned correctly except the uint64 values. I have read that for uint64 values you need to actually provide the data as a BSTR. It does work on 99% of the machines I have tried it on. This is how I am accomplishing that.v.vt = VT_BSTR; v.bstrVal
CoolStraw
c# .net visual-studio wmi clr4.0
I have the windows console program code below that should show up NT Authoroty\Network Service but surprisingly it spells NetworkService without a space… When I check the account the SQLAgent is running on it’s indeed Network Service.Why does this code delete the space? it breaks all my solution down by doing so as NetworkService does not exist.PS: I don’t want to hard code the user; I must get it automatically.class Program {static string GetSQLAgentUsername(){string servicePath = string.Form
bluish
c++ windows-services windows-server-2008 wmi
I’ve implemented a WMI provider (Window service, Instance, Methods and Properties provider). It works fine on Windows Server 2003, but when it run on Windows Server 2008 with non-local administrator user, I cannot query it.The error I get is 0x8004101d – unexpected error.When the service user is a local admin everything is OK.What could it be???Thanks!
Web site is in building