Vb script

Author Message
vishalvijayan

  • Total Posts : 6
  • Scores: 0
  • Reward points : 0
  • Joined: 7/5/2010
  • Status: offline
Vb script Tuesday, July 06, 2010 11:14 PM (permalink)
0
Hello,

I have a excel file (workflowtracker.xls) with 2 sheets. Sheet 1 - user input and sheet 2 (dashboard) using values from a excel file. I can do it in the same excel file on sheet 2. Sheet 1 has all the user input data and sheet 2(dashboard) has a summary of data or you can say a list of delayed deliveries, WIP etc.

Now I want to make the dashboard working from a separate excel file as keeping both  the sheets in the same file is a security risk.

Can anyone help me with the code. my sheet 2 should be in a separate excel file. How to call the the first excel file.

Option Explicit

Dim TempVal As String

Private Sub Worksheet_Activate()

     Application.DisplayAlerts = False
     TempVal = Range("G5").Value
     Range("G5").Value = "Wait Refreshing Data"
     Application.ScreenUpdating = False
     If ActiveSheet.AutoFilterMode = False Then
          Range("A5:G65536").Select
          Selection.AutoFilter
     Else
          If ActiveSheet.FilterMode = True Then
               ActiveSheet.ShowAllData
          End If
     End If

     Range("A6").FormulaR1C1 = _
     "=IF(OR('Daily Workflow Tracker'!RC[20]>=3,'Daily Workflow Tracker'!RC[22]>0),'Daily Workflow Tracker'!RC,"""")"
     Range("B6").FormulaR1C1 = "=IF(RC[-1]<>"""",'Daily Workflow Tracker'!RC[5],"""")"
     Range("C6").FormulaR1C1 = "=IF(RC[-2]<>"""",'Daily Workflow Tracker'!RC[8],"""")"
     Range("D6").FormulaR1C1 = "=IF(RC[-3]<>"""",'Daily Workflow Tracker'!RC[10],"""")"
     Range("E6").FormulaR1C1 = "=IF(RC[-4]<>"""",'Daily Workflow Tracker'!RC[16],"""")"
     Range("F6").FormulaR1C1 = "=IF(RC[-5]<>"""",'Daily Workflow Tracker'!RC[17],"""")"

 
#1
    ebgreen

    • Total Posts : 8227
    • Scores: 98
    • Reward points : 0
    • Joined: 7/12/2005
    • Status: offline
    Re:Vb script Wednesday, July 07, 2010 12:54 AM (permalink)
    0
    Just to be clear you are writing VBA code and this is a VBScript forum.

    To figure out your situation, personally I would record a macro of opening the other workbook just to get a starting point for the code.
    "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
    Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
    http://www.visualbasicscript.com/m_47117/tm.htm
     
    #2
      andrewx

      • Total Posts : 7
      • Scores: 0
      • Reward points : 0
      • Joined: 9/22/2010
      • Status: offline
      Re:help Saturday, November 20, 2010 2:29 AM (permalink)
      0
      Hey,
      One time i am developed my website and this is
      Destory by spam can any one suggestion me for
      Vb.net captch.
      __________________
      ethical hacking

       
      #3
        ebgreen

        • Total Posts : 8227
        • Scores: 98
        • Reward points : 0
        • Joined: 7/12/2005
        • Status: offline
        Re:help Monday, November 22, 2010 2:49 AM (permalink)
        0
        Please post your question as it's own thread in the Other Languages section of the site.
        "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
        Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
        http://www.visualbasicscript.com/m_47117/tm.htm
         
        #4
          Mey

          • Total Posts : 1
          • Scores: 0
          • Reward points : 0
          • Joined: 2/25/2011
          • Status: offline
          Re:help Friday, February 25, 2011 8:10 PM (permalink)
          0
          Hello All,
          could I please get you to review this script, The idea is to allow the techs to rename a computer remotely via the script. But this script is saying error,Any one please provide appropraite code?
          Requirement :Rename the computer remotely
           
          'this script loops through all the computers and runs the NETDOM command to rename the computer
          'input file is computerstorename.txt is csv format (old name, new name)

          Option Explicit
          'On Error Resume NExt
          Const ForReading = 1
          Dim objFSO
          Dim objShell
          Dim objTextFile
          Dim strLine, strComputerArray
          Dim strCommand
          Dim Return
          Dim strValue
          Set objFSO = CreateObject("Scripting.FileSystemObject")
          Set objShell = CreateObject("Wscript.Shell")
          Set objTextFile = objFSO.OpenTextFile("C:\computertorename.txt", ForReading)
          Do Until objTextFile.AtEndOfStream
              strLine = objTextFile.ReadLine
              strComputerArray = Split(strLine,",")
              'strComputerArray(0) is old name
              'strComputerArray(1) is new name

              'check if computer is online
              If Ping(strComputerArray(0)) Then
                  'computer is online
           strCommand =  "NETDOM RENAMECOMPUTER " & strComputerArray(0) & " /NewName:" & strComputerArray(1) & " /Force /REBoot:60"
           Wscript.echo strCommand
           objShell.Run strCommand,1,true
           'wait for 6 seconds
           wscript.sleep(6000)
           Return = objShell.Run (strCommand,1,true)
           Wscript.echo strComputerArray(0) & " renamed to " & strComputerArray(1)
           strValue = strComputerArray(0) & "," & Return
           
              Else
                  'computer not online
           Wscript.Echo strComputerArray(0) & ",not online"
           strValue = strComputerArray(0) & ",not online"
           
              End If
              'write to output
              Set fs = CreateObject("Scripting.FileSystemObject")
              Set file = fs.OpenTextFile("C:\renameresults.txt", 8, True)
              file.Write strValue & vbCrLf
              file.close
          Loop
          objTextFile.Close
          wscript.echo "Done"
          wscript.quit
           
           
          Function Ping(Target)
          Dim results
              Set shell = CreateObject("WScript.Shell")
             
              ' Send 1 echo request, waiting 2 seconds for result
              Set exec = shell.Exec("ping -n 1 -w 2000 " & Target)
              results = LCase(exec.StdOut.ReadAll)
             
              Ping = (InStr(results, "reply from") > 0)
          End Function
           
          #5
            andrewx

            • Total Posts : 7
            • Scores: 0
            • Reward points : 0
            • Joined: 9/22/2010
            • Status: offline
            Re:help Friday, May 13, 2011 1:57 AM (permalink)
            0
            Hi everyone, I have the same problem but now this is solved. I have use the suggestion of may and now the problem is sort. I think you will also use this suggestion.

            Thanks !
            krogen krogragg dating festa
             
            #6

              Online Bookmarks Sharing: Share/Bookmark

              Jump to:

              Current active users

              There are 0 members and 1 guests.

              Icon Legend and Permission

              • New Messages
              • No New Messages
              • Hot Topic w/ New Messages
              • Hot Topic w/o New Messages
              • Locked w/ New Messages
              • Locked w/o New Messages
              • Read Message
              • Post New Thread
              • Reply to message
              • Post New Poll
              • Submit Vote
              • Post reward post
              • Delete my own posts
              • Delete my own threads
              • Rate post

              2000-2012 ASPPlayground.NET Forum Version 3.9