Advertisement

04.01.2008 at 07:50AM PDT, ID: 23285951
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.7

Can these 2 macros be combined into one. 1. Is to get if machines are 64 or 32 bit 2. Get Mac address.

Asked by bsharath in Microsoft Excel Spreadsheet Software, Programming Languages, Visual Basic Programming

Tags: , ,

Hi,

Can these 2 macros be combined into one. 1. Is to get if machines are 64 or 32 bit 2. Get Mac address.

Code 1
Sub Get_64bit_32bit_Hardware()
Application.DisplayAlerts = False
    Const wbemFlagReturnImmediately = &H10
    Const wbemFlagForwardOnly = &H20
   
    For intRow = 2 To Cells(65536, "Q").End(xlUp).Row
        If Cells(intRow, "AC").Value = "" Then
            strComputer = Cells(intRow, "Q").Value
            On Error Resume Next
            Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
            If Err.Number = 0 Then
                On Error GoTo 0
                Set colItems = objWMIService.ExecQuery("SELECT AddressWidth FROM Win32_Processor", "WQL", _
                    wbemFlagReturnImmediately + wbemFlagForwardOnly)
           
                For Each objItem In colItems
                    Cells(intRow, "AC").Value = objItem.AddressWidth & "-bit"
                Next
            End If
        End If
    Next
    MsgBox "Done"
    Application.DisplayAlerts = True
End Sub


Code 2

Sub Display_MAC_Address()
Application.DisplayAlerts = False
 
    For intRow = 2 To Cells(65536, "Q").End(xlUp).Row
        strComputer = Cells(intRow, "Q").Value
        If Ping(strComputer) = True Then
            strMACAddress = Get_MAC_Address(strComputer)
            Cells(intRow, "AD").Value = strMACAddress
        End If
    Next
    MsgBox "Finished."
    Application.DisplayAlerts = True
 
End Sub
 
Function Ping(strComputer)
    Dim objShell, boolCode
    Set objShell = CreateObject("WScript.Shell")
    boolCode = objShell.Run("Ping -n 4 -w 300 " & strComputer, 0, True)
    If boolCode = 0 Then
        Ping = True
    Else
        Ping = False
    End If
End Function
 
Function Get_MAC_Address(strComputer)
    Set objShell = CreateObject("WScript.Shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    On Error Resume Next
    objFSO.DeleteFile "D:\MAC.txt", True
    On Error GoTo 0
    objShell.Run "cmd /c NBTSTAT -a " & strComputer & " | FIND ""MAC Address"" > D:\MAC.txt", 0, True
 
    Set objMACFile = objFSO.openTextFile("D:\MAC.txt", 1, False)
    While Not objMACFile.AtEndOfStream
        strLine = objMACFile.ReadLine
        If Len(strLine) > 35 Then
            strMAC = Mid(strLine, 19, 17)
        End If
    Wend
    objMACFile.Close
    Set objMACFile = Nothing
    Set objShell = Nothing
    Set objFSO = Nothing
    Get_MAC_Address = strMAC
End Function


These 2 macros work perfect in seperately.
As i have lots of macros need to combine some.
Is it possible that it checks the machine names in colum "Q" and query 1 machine on both the tasks and then come to the next.

Regards
Sharath
Start Free Trial
[+][-]04.01.2008 at 10:02AM PDT, ID: 21255913

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.01.2008 at 07:48PM PDT, ID: 21259828

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.01.2008 at 07:48PM PDT, ID: 21259829

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.03.2008 at 07:06AM PDT, ID: 21272781

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Excel Spreadsheet Software, Programming Languages, Visual Basic Programming
Tags: Excel, Macro, Scripting
Sign Up Now!
Solution Provided By: ravs
Participating Experts: 1
Solution Grade: A
 
 
[+][-]04.03.2008 at 07:13AM PDT, ID: 21272850

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.03.2008 at 09:07AM PDT, ID: 21274024

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.03.2008 at 09:19AM PDT, ID: 21274178

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.03.2008 at 11:23AM PDT, ID: 21275385

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.03.2008 at 07:34PM PDT, ID: 21278682

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.03.2008 at 07:35PM PDT, ID: 21278683

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.04.2008 at 05:00AM PDT, ID: 21280728

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906