ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Computer name (https://www.excelbanter.com/excel-discussion-misc-queries/199140-computer-name.html)

Art

Computer name
 
Hello:

Does anybody know how to display through a formula or vba the computer name
in excel 2007?
And what about the Windows product ID?
Please let me know.

Rick Rothstein \(MVP - VB\)[_1122_]

Computer name
 
Using VBA... you can get the computer name with this function call...

CN = Environ("ComputerName")

What do you expect the product ID to look like? I'm guessing the value from
this property call is not what you are looking for?

PC = Application.ProductCode

Rick


"art" wrote in message
...
Hello:

Does anybody know how to display through a formula or vba the computer
name
in excel 2007?
And what about the Windows product ID?
Please let me know.



Art

Computer name
 
Can you please give me the full vba code?

Thanks.

"Rick Rothstein (MVP - VB)" wrote:

Using VBA... you can get the computer name with this function call...

CN = Environ("ComputerName")

What do you expect the product ID to look like? I'm guessing the value from
this property call is not what you are looking for?

PC = Application.ProductCode

Rick


"art" wrote in message
...
Hello:

Does anybody know how to display through a formula or vba the computer
name
in excel 2007?
And what about the Windows product ID?
Please let me know.




Rick Rothstein \(MVP - VB\)[_1126_]

Computer name
 
The statements I posted are the "full code" and assume you are assigning the
computer name to the variable CN and assigning the Product Code (which may
or may not be what you intended when you said "product ID") to the variable
PC... just assign them to your own variables instead.

Perhaps this will help you see what is going on. Type this statement in the
Immediate window and hit the Return key...

MsgBox Environ("ComputerName")

Now do the same for this statement...

MsgBox Application.ProductCode

Rick


"art" wrote in message
...
Can you please give me the full vba code?

Thanks.

"Rick Rothstein (MVP - VB)" wrote:

Using VBA... you can get the computer name with this function call...

CN = Environ("ComputerName")

What do you expect the product ID to look like? I'm guessing the value
from
this property call is not what you are looking for?

PC = Application.ProductCode

Rick


"art" wrote in message
...
Hello:

Does anybody know how to display through a formula or vba the computer
name
in excel 2007?
And what about the Windows product ID?
Please let me know.





Art

Computer name
 
It doesnt work. Can you send me the full code? HOw do I enter it in a module?
just MsgBox Environ("ComputerName")? And how Do I use the formula after
wards?

P.S. the product ID I meant was another way I want to identify the computer
instead of using the computer name.

Thanks

"Rick Rothstein (MVP - VB)" wrote:

The statements I posted are the "full code" and assume you are assigning the
computer name to the variable CN and assigning the Product Code (which may
or may not be what you intended when you said "product ID") to the variable
PC... just assign them to your own variables instead.

Perhaps this will help you see what is going on. Type this statement in the
Immediate window and hit the Return key...

MsgBox Environ("ComputerName")

Now do the same for this statement...

MsgBox Application.ProductCode

Rick


"art" wrote in message
...
Can you please give me the full vba code?

Thanks.

"Rick Rothstein (MVP - VB)" wrote:

Using VBA... you can get the computer name with this function call...

CN = Environ("ComputerName")

What do you expect the product ID to look like? I'm guessing the value
from
this property call is not what you are looking for?

PC = Application.ProductCode

Rick


"art" wrote in message
...
Hello:

Does anybody know how to display through a formula or vba the computer
name
in excel 2007?
And what about the Windows product ID?
Please let me know.





Rick Rothstein \(MVP - VB\)[_1127_]

Computer name
 
Actually, the code does work, but I am thinking you are not as familiar with
VBA coding as your original posting may have suggested. Here are the steps
you can take to see the computer's name... From any worksheet, right click
the tab at the bottom of the worksheet and select View Code. Copy/Paste this
code into the window that appeared when you did this...

Sub SeeComputerName()
MsgBox "My computer's name: " & Environ("ComputerName")
End Sub

Now, go back to your worksheet, press Alt+F8 and select the SeeComputerName
item from the list that appears and click the Run button. Now, since
implementing this basic code cause you problems, I am going to suggest you
read up on creating macros before you continue trying to do more complicated
programming. Check out this link as a starter...

http://www.anthony-vba.kefra.com/index_011.htm

(start with the 3 basic tutorials) and, perhaps, buying a basic Excel VBA
book to read might be helpful also.

Rick


"art" wrote in message
...
It doesnt work. Can you send me the full code? HOw do I enter it in a
module?
just MsgBox Environ("ComputerName")? And how Do I use the formula after
wards?

P.S. the product ID I meant was another way I want to identify the
computer
instead of using the computer name.

Thanks

"Rick Rothstein (MVP - VB)" wrote:

The statements I posted are the "full code" and assume you are assigning
the
computer name to the variable CN and assigning the Product Code (which
may
or may not be what you intended when you said "product ID") to the
variable
PC... just assign them to your own variables instead.

Perhaps this will help you see what is going on. Type this statement in
the
Immediate window and hit the Return key...

MsgBox Environ("ComputerName")

Now do the same for this statement...

MsgBox Application.ProductCode

Rick


"art" wrote in message
...
Can you please give me the full vba code?

Thanks.

"Rick Rothstein (MVP - VB)" wrote:

Using VBA... you can get the computer name with this function call...

CN = Environ("ComputerName")

What do you expect the product ID to look like? I'm guessing the value
from
this property call is not what you are looking for?

PC = Application.ProductCode

Rick


"art" wrote in message
...
Hello:

Does anybody know how to display through a formula or vba the
computer
name
in excel 2007?
And what about the Windows product ID?
Please let me know.






Art

Computer name
 
How can I get this result in a formula?

Sub MyprodID()
MsgBox "My ProgID is " & _
Application.COMAddIns(1).progID & _
" and my GUID is " & _
Application.COMAddIns(1).GUID
End Sub


That means I should have the formula to be able to see the same results as
in the msg box?

"Rick Rothstein (MVP - VB)" wrote:

Actually, the code does work, but I am thinking you are not as familiar with
VBA coding as your original posting may have suggested. Here are the steps
you can take to see the computer's name... From any worksheet, right click
the tab at the bottom of the worksheet and select View Code. Copy/Paste this
code into the window that appeared when you did this...

Sub SeeComputerName()
MsgBox "My computer's name: " & Environ("ComputerName")
End Sub

Now, go back to your worksheet, press Alt+F8 and select the SeeComputerName
item from the list that appears and click the Run button. Now, since
implementing this basic code cause you problems, I am going to suggest you
read up on creating macros before you continue trying to do more complicated
programming. Check out this link as a starter...

http://www.anthony-vba.kefra.com/index_011.htm

(start with the 3 basic tutorials) and, perhaps, buying a basic Excel VBA
book to read might be helpful also.

Rick


"art" wrote in message
...
It doesnt work. Can you send me the full code? HOw do I enter it in a
module?
just MsgBox Environ("ComputerName")? And how Do I use the formula after
wards?

P.S. the product ID I meant was another way I want to identify the
computer
instead of using the computer name.

Thanks

"Rick Rothstein (MVP - VB)" wrote:

The statements I posted are the "full code" and assume you are assigning
the
computer name to the variable CN and assigning the Product Code (which
may
or may not be what you intended when you said "product ID") to the
variable
PC... just assign them to your own variables instead.

Perhaps this will help you see what is going on. Type this statement in
the
Immediate window and hit the Return key...

MsgBox Environ("ComputerName")

Now do the same for this statement...

MsgBox Application.ProductCode

Rick


"art" wrote in message
...
Can you please give me the full vba code?

Thanks.

"Rick Rothstein (MVP - VB)" wrote:

Using VBA... you can get the computer name with this function call...

CN = Environ("ComputerName")

What do you expect the product ID to look like? I'm guessing the value
from
this property call is not what you are looking for?

PC = Application.ProductCode

Rick


"art" wrote in message
...
Hello:

Does anybody know how to display through a formula or vba the
computer
name
in excel 2007?
And what about the Windows product ID?
Please let me know.







Rick Rothstein \(MVP - VB\)[_1128_]

Computer name
 
I really do not think those properties are what you want... on my system
they return the AddIn name and GUID for my Dymo Label printer. In any event,
assuming you really do want them (or if you find what you actually want
later on), the method to be able to display these results in a cell on a
worksheet using a formula (known as a User Defined Function or UDF for
short) in the cell is as follows. Go into the VB editor and put the
following code in a Module (get the Module the same way I told you on one of
your other posts in another newsgroup... click Insert/Module from the VB
editor's menu bar)...

Function GetProgIDs()
GetProgIDs = Application.COMAddIns(1).progID & " -- " & _
Application.COMAddIns(1).GUID
End Function

Now, back on your worksheet, type this into any cell....

=GetProgIDs()

(the parentheses are required) and the information you asked about will be
displayed in the cell.

Rick


"art" wrote in message
...
How can I get this result in a formula?

Sub MyprodID()
MsgBox "My ProgID is " & _
Application.COMAddIns(1).progID & _
" and my GUID is " & _
Application.COMAddIns(1).GUID
End Sub


That means I should have the formula to be able to see the same results as
in the msg box?

"Rick Rothstein (MVP - VB)" wrote:

Actually, the code does work, but I am thinking you are not as familiar
with
VBA coding as your original posting may have suggested. Here are the
steps
you can take to see the computer's name... From any worksheet, right
click
the tab at the bottom of the worksheet and select View Code. Copy/Paste
this
code into the window that appeared when you did this...

Sub SeeComputerName()
MsgBox "My computer's name: " & Environ("ComputerName")
End Sub

Now, go back to your worksheet, press Alt+F8 and select the
SeeComputerName
item from the list that appears and click the Run button. Now, since
implementing this basic code cause you problems, I am going to suggest
you
read up on creating macros before you continue trying to do more
complicated
programming. Check out this link as a starter...

http://www.anthony-vba.kefra.com/index_011.htm

(start with the 3 basic tutorials) and, perhaps, buying a basic Excel VBA
book to read might be helpful also.

Rick


"art" wrote in message
...
It doesnt work. Can you send me the full code? HOw do I enter it in a
module?
just MsgBox Environ("ComputerName")? And how Do I use the formula after
wards?

P.S. the product ID I meant was another way I want to identify the
computer
instead of using the computer name.

Thanks

"Rick Rothstein (MVP - VB)" wrote:

The statements I posted are the "full code" and assume you are
assigning
the
computer name to the variable CN and assigning the Product Code (which
may
or may not be what you intended when you said "product ID") to the
variable
PC... just assign them to your own variables instead.

Perhaps this will help you see what is going on. Type this statement
in
the
Immediate window and hit the Return key...

MsgBox Environ("ComputerName")

Now do the same for this statement...

MsgBox Application.ProductCode

Rick


"art" wrote in message
...
Can you please give me the full vba code?

Thanks.

"Rick Rothstein (MVP - VB)" wrote:

Using VBA... you can get the computer name with this function
call...

CN = Environ("ComputerName")

What do you expect the product ID to look like? I'm guessing the
value
from
this property call is not what you are looking for?

PC = Application.ProductCode

Rick


"art" wrote in message
...
Hello:

Does anybody know how to display through a formula or vba the
computer
name
in excel 2007?
And what about the Windows product ID?
Please let me know.









All times are GMT +1. The time now is 12:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com