• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA prompts for userid within file path

DeeDawg

New Member
Hello experts. I have the following code working ok for me, but I really would like to fine tune so that peers may use the file also. In the code you will notice the userid (username) "doatis". That makes the vba work for me only. Is there a way to get the vba to prompt others for their own userid then continue to run? Thank you very much in advance. I'm just stumped on this.

Code:
GetData()
'
' GetData Macro
' Retrieves raw data from daily validation report and daily summary report in GLS
'
'
  Workbooks.Open Filename:="\\s06099nts800us.s06099.us\GLS_UserData\doatis\My Documents\GLS.Management\DailyData\DailyValidation.xlsb"

  Range("A1:G1").Select

  Range(Selection, Selection.End(xlDown)).Select

  Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select

  Selection.Copy

  Windows("Daily Hours Validation AnalyzerWeek23b.xlsm").Activate

  Sheets(" Validation Report Import").Select

  Range("A1415:B1415").Select

  ActiveSheet.Paste

  Windows("DailyValidation.xlsb").Activate

  Application.CutCopyMode = False

  ActiveWindow.Close

  Sheets("Standard Summary Import").Select

  Range("A636").Select

  Workbooks.Open Filename:="\\s06099nts800us.s06099.us\GLS_UserData\doatis\My Documents\GLS.Management\DailyData\Standard Summary.xls"

  Range("A1:J1").Select

  Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select

  Selection.Copy

  Windows("Daily Hours Validation AnalyzerWeek23b.xlsm").Activate

  ActiveSheet.Paste

  Windows("Standard Summary.xls").Activate

  Application.CutCopyMode = False

  ActiveWindow.Close

  Sheets("Multiple Days - by Ops").Select

  Range("H7").Select
 
Last edited by a moderator:
At the beginning, do something like this
Code:
Dim myName As String
myName = InputBox("What is your user name?", "User Name")

 Workbooks.Open Filename:="\\s06099nts800us.s06099.us\GLS_UserData\" & myName & "\My Documents\GLS.Management\DailyData\DailyValidation.xlsb"
 
Back
Top