I have a Word VBA function that I'm trying to create in Excel VBA (the reason for this choice comes from this question ), and I'm stuck with the following problem:
The Word VBA function is widely used System.PrivateProfileString, which throws an error Compile Error: invalid qualifierwhen applied to Excel VBA. What is the equivalent instruction in Excel? Alternatively, how do I do this?
System.PrivateProfileString
Compile Error: invalid qualifier
Usage example:
strHomeSharePath = System.PrivateProfileString("", "HKEY_CURRENT_USER\Volatile Environment", "HOMESHARE")
Hi, if you want to read registerability in Excel, you can do it this way.
Sub test() Dim strPath As String strPath = RegKeyRead("HKEY_CURRENT_USER\Volatile Environment\HOMESHARE") End Sub Function RegKeyRead(i_RegKey As String) As String Dim myWS As Object On Error Resume Next 'access Windows scripting Set myWS = CreateObject("WScript.Shell") 'read key from registry RegKeyRead = myWS.RegRead(i_RegKey) End Function
( ) Excel Object, , "objWord", ...
strHomeSharePath = objWord.System.PrivateProfileString("", "HKEY_CURRENT_USER\Volatile Environment", "HOMESHARE")
IMO "" , , Word. Word.
Source: https://habr.com/ru/post/1626146/More articles:Java8: Filter and compare 2 lists with Lambda - javaHow to run and minimize angular2 application? - javascriptpsql parsing error while moving cursor .fetchall () - pythonМассив JavaScript уменьшает начало с индекса - javascriptFind the inverse matrix in MATLAB, is inv (A) or A \ eye (size (A)) more accurate? - matrixConverting a JSON array to a list of Java class objects - javavba read all text in a text file? - vbaHow can I add school_id to my path? - ruby | fooobar.comSubstitution of one matrix onto another matrix - runittest cannot detect / run tests - pythonAll Articles