I am doing a little tweaking of an excel document we use in work. Basically want to automate the filling out of any fields I can.
Ive got the current time and date working fine, but theres a "packed by" box, which tends to be filled in with the initials of the person who opened it.
Is there anyway of getting this information from a macro? So the currently logged in user gets listed in the "Packed by" Field?
ive done it the other way round quite a few times....
in that ive made a vb6 interface program and let that generate an excel sheet.
use that to generate replacement reports they get on the current system.
if you need some details lemme know,
but its as simple as declaring xlapp as new excel.application and adding workbook and sheets to it.
anything you can do in excel you can call from vb6
I dont think you can pull the username from a macro but it is certainly avalible from an API call.
:(
Its just an excel spreadsheet that gets sent out to our sales staff for them to email a copy in filled out when they need some more stationary and stuff :) Cant make it an application but just want it to grab the current windows login and shove it in the field :) so that when the packers print off the order sheet it gives their names there.
Its available from the ENVIRON function in Excel.
Use something like this:
Function UserNameWindows() As String
UserNameWindows = Environ("USERNAME")
End Sub
I dont have Excel on this box at the moment but I tried that in word and Im reasonably convinced the same thing is available in Excel.