VBA MVP's: Restart Windows Service With A Macro
Feb 10, 2010
Is it possible to restart a Windows Service with execution from a VBA Macro?
When you go into Windows Computer Management you can see a list of services. You can click a hyperlink to start, pause or restart.
View 9 Replies
ADVERTISEMENT
Dec 8, 2009
I have an excel spreadsheet with the column headings a1(Emp Name), b1(Hire Date[dd/mm/yy]). There around 1000 records of employees. Every month I have to generate a report for the following month, for example by the 3rd week of this December 2009 I have to extract the report of following staffs from those 1000+ records.
- those who will be completing 1 year in January 2010
- those who will be completing 5 years in January 2010
- those who will be completing 10 years in January 2010
- those who will be completing 20 years in January 2010
How shoud I do it? What should be the formula in which cells? I would appreciate if anyone could guide me with the complete formula with a very reliable way to do it.
View 9 Replies
View Related
Dec 18, 2007
I am trying to pause a macro on a protected sheet, select 2 adjacent cells (initially protected), utilize an existing drop down box to select a name from the list, copy the name from the list into the range of cells, then re-start the macro.
I had no problem when there was just one name (see John Smith below). I tried to use the InputBox command but needed to actually type in the name.
ActiveSheet.Unprotect
Range("C27:D27").Select
'ActiveCell.FormulaR1C1 = "John Smith"
' Application.CutCopyMode = False
' ActiveSheet.Paste
'Range("c27:d27") = InputBox("Enter value")
View 4 Replies
View Related
Mar 19, 2014
I've written a macro for work that will work with our billing process. After part of it has run, I'd like to pause it for the user to check a column for errors and possibly update a table to get rid of those errors, then after those errors are fixed, have the ability to continue with the rest of the code. I tried to make a message box to remind the user to look for the errors, but it wouldn't allow me to click anywhere except for on the buttons.
View 4 Replies
View Related
Jan 20, 2010
I've got a series of macros in place which, essentially, download several CSV files into a temp directory, then opens each and copies the data into a single workbook (one sheet).
What happens is that the some number of the sheets don't actually open until the macro stops. I've tried using the wait (Application.Wait Now + TimeValue("00:00:10")) and sleep functions, but it's not quite doing what I want.
What I'd LIKE to do is have the macro actually STOP processing for 10 seconds, then proceed (or start a new macro).
I've also tried putting the wait behind a button in a userform, which is non modal... the csv files open until the user clicks the button.
View 9 Replies
View Related
Aug 15, 2013
Is it possible to write a code that will automatically restart a PC when a STRING in CELL A1 is recognized? My cell A1 populates a user's USERNAME upon opening the workbook.
View 9 Replies
View Related
Jun 26, 2008
When I run the following code, if "If exists = True" then I want the routine to start again at the very beginning. Currently, 'as is' it re-starts at the beginning but enters a loop on itself; I understand why this is but it's not what I want but can't get round this! How do I make the "If exists = True" condition (if true) restart the routine - ie call AllNEWActions() without then going into a loop on itself? NB: I can't use "Exit Sub" (see it commented out) as I don't want to exit routine, just restart it.
Sub AllNEWActions()
ShowCalendar
GetDateFromCalendar
SheetAlreadyExists
If exists = True Then
boolRestart = True
AllNEWActions
' Exit Sub
Else
MsgBox (" Date selected/new sheet doesn't exist")
InsertNewSheet
End If
If boolRestart = False Then
ShowCalendar
GetDateFromCalendar
End If
MsgBox ("Do something ...)
End Sub
View 2 Replies
View Related
Jun 25, 2008
I have a macro that runs when the workbook opens. At the end of my macro I've added a Yes/No box. If 'No' the workbook closes without saving. If 'Yes' I would like to restart the macro. I can close it ok, but I don't know how to restart the macro from line 1 when 'Yes' is selected. Here is what I have:
YesNo = MsgBox("Done! Would you like to run again?", vbYesNo + vbCritical, "Caution")
Select Case YesNo
Case vbYes
'I don't know what to put here :(
Case vbNo
ActiveWorkbook.Close savechanges:=False
End Select
View 3 Replies
View Related
May 18, 2014
I've sent the file to 2 different windows computers and it works fine, but doesn't work with the two macs that I've sent it to.
This is the code:
[Code] .....
View 2 Replies
View Related
Apr 29, 2014
Ive been looking at a bunch of examples, but everything that I have tried just gives me errors. what code to use to make a vbs script to run in windows task scheduler that will...
Open "J:GroupsBSHEETSSDANew EOD.xlsm"
Run the macro named "EODPrint"
Save the workbook
and close the workbook
Leaving excel open if other instances exist.
View 9 Replies
View Related
Mar 12, 2007
how can i set a macro to start on whenever the computer is started first on any day.
View 2 Replies
View Related
Feb 24, 2013
I write a excel file (with macros included) to tackle the datas regarding stock market.
The excel file encompasses some information about financial reports, and some functions (macro) like sorting and filtering.
I'm wondering if I can build it as an windows 8 App and put it on the App market.
Or, in other words, can I make a windows 8 App by the functions in Excel ?
Can I do that ?
View 1 Replies
View Related
Jan 29, 2007
I've been using the following bit of code to run a macro at the specified time:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Application .OnTime TimeValue("12:00:00"), "GetData"
End Sub
The GetData sub executes a shell script and then pulls data from the result. The problem is that the macro runs 140+ times, and so I get 140 windows popping up and the system practically stops. I can't figure out why this is happening, as there are no loops or any sort of repetition in the code. Any help is greatly appreciated as this problem occurs with more than just the one spreadsheet.
View 9 Replies
View Related
Jun 6, 2002
What's the code for opening a Windows Explorer window from within an Excel Macro?
View 7 Replies
View Related
Mar 17, 2013
how to create and add password to a default windows zip file using vba excel macro.
View 2 Replies
View Related
Apr 19, 2013
Working with Windows 7 and Office 2010
I've created a Excel workbook with VBA code to synchronize an Access database between a laptop and a server. One of the fields in the database is a shortcut to a jpg for each record. (The Access stuff is not too important here)
Now I'd like to add the ability synchronize the photos between the laptop and the server; so people who use the server can view the photos added by the laptop and vice versa.
Something like:
Code:
For each [JPG] in [LaptopFolder]
If not [JPG] exists in [ServerFolder] then
filecopy [LaptopFolder][JPG], [ServerFolder][JPG]
end if
next [JPG]
That code wouldn't work.
View 4 Replies
View Related
Jun 29, 2006
I'm trying to run a macro on my machine (Windows 2000 and Office 2003) and I keep getting an error on one method. Now I tried to run the same macro on a different machine (Windows XP and Office 2003) and it didn't error out.
Public strControlTitle As String
Public strControlTime As String
Public strControlUnit As String
Public intControlItem As Integer
Public intLastNameOnly As Integer
Public intDataType As Integer
Sub Main()
Dim strControlItem, strPageName, strValue, sigma, z95, z99 As String
Dim r, c, count, cmax, rmax, rt, ct, low, high, a, b As Integer
Dim lesscol As Integer
With ControlChartForm
.ComboBox1.AddItem ("Average Turn Around Time All Patients")....................
View 4 Replies
View Related
Aug 15, 2008
What can I do to have a sub only run when a random number is above a certain value? I have tried this:
Sub Filter()
With Application
Calculate
If Range("Count") >= 2 Then
Range("J8:O8").select
.Calculation = xlManual
Else: Application.Goto Filter
End If
End With
End Sub
Am i using goto incorrectly or should I try some sort of loop?
View 3 Replies
View Related
Nov 20, 2013
I have been given a macro recorded on a mac and it works fine with Mac Excel 2011. Unfortunately, I need to make it to work on a windows machine, but it comes up with an error message "macro unable to set width property of the window class. Run-time error 1004". When I press debug it takes me to the line .Width = 1456.
Below is the chunk of the code that becomes highlighted when pressing debug.
With ActiveWindow
.Width = 1456
.Height = 795
End With
View 3 Replies
View Related
Apr 22, 2008
I have just successfully added a code to Visual Basic in order for it to insert a sequential number automatically upon opening the worksheet. It works great, but how do I restart the numbering now that I know it works?
View 9 Replies
View Related
Jun 17, 2013
I'm looking for a simple solution to pause a VBA loop and then restart it from where it stopped.
Is it with a boolean value, i dont know the code.
View 9 Replies
View Related
Jul 17, 2006
I would like to create a formula that would calculate the length of a person's employment, i.e. hired 8/14/94 till today, for example.
View 10 Replies
View Related
Jun 23, 2009
I have a large spreadsheet like this
NephrologyPrinted resent 26.05.09 chased
Nephrology28.04.09 resent 26.05.09Yes
Nephrology28.04.09 resent 26.05.09Yes
Nephrology28.04.09 resent 26.05.09Yes
Nephrology28.04.09 resent 26.05.09Yes
Nephrology28.04.09 resent 26.05.09Yes
There are plenty of other columns, but these are key. The first column is the service type, of which there are 40. I want to have another worksheet that totals all the entries in the third column that don't say 'yes', for each service. So, in this case the first line of my new workbook would say: Nephrology1
View 4 Replies
View Related
Feb 11, 2012
I run stats for an operating room and want to be able to look at total patient in room minutes between 7 AM and 3 PM. Problem is, many cases go past 3pm and I want to subtract that out. I have patient in room time and patient out of room time, so in essence I want the total number of minutes the patient was in the room between the two times minus turnover time. I have a pivot table ready to go.
View 7 Replies
View Related
May 14, 2014
I have a web service URL from vendor, i need to call the particular method in that web service and pass parameters to method from VBA excel. In C# its working fine.Same method like i need to do from from Excel VBA. My doubt is how to form authenticate xml and how to call a particular method using soap action URL.
View 1 Replies
View Related
Jul 2, 2014
How do I run this loop 10 times ....Then using a timer or system clock to restart it.
Code:
Public Sub Workbook_Open()
Dim ws As Worksheet
Do
For Each ws In ThisWorkbook.Worksheets
[Code]....
View 1 Replies
View Related
Dec 13, 2012
The formula that I currently have in E2, is giving me the number of years served by an employee. Is there another formula that can give me the number of years each employee has served? This is the formula that I have in E2
[Code] .....
Attached File : VACATION DAYS ACCURED.xls
View 9 Replies
View Related
Apr 12, 2012
I'm trying to find a formula for calculating the number of business hours a service request may be open; this request may have been opened and even closed outside of business hours. I found a formula that appears to be working:
=(NETWORKDAYS(StartDate&TimeCell,StopDate&TimeCell,holidays)-1)*(CloseTimeColumnLetter$CloseTimeRowNumber-OpenTimeColumnLetter$OpenTimeRowNumber)+IF(NETWORKDAYS(StopDate&TimeCell,StopDate&TimeCell,holidays),MEDIAN(MOD(StopDate&TimeCell,1),CloseTimeColumnLetter$CloseTimeRowNumber, OpenTimeColumnLetter$OpenTimeRowNumber),CloseTimeColumnLetter$CloseTimeRowNumber)-MEDIAN(NETWORKDAYS(StartDate&TimeCell,StartDate&TimeCell,holidays)*MOD(StartDate&TimeCell,1),
CloseTimeColumnLetter$CloseTimeRowNumber, OpenTimeColumnLetter$OpenTimeRowNumber)
What I don't know is HOW it works, I don't know what any of those formula's mean (with the exception of NETWORKDAYS). I'm trying to "show my work".
View 1 Replies
View Related
Apr 16, 2007
i am working on a redundancy table to calculate lenght of service at a certain age and what the redundancy in years will be,
age----------------years
less than 23------0.75 per year
23 to 42----------1.5 per year
43 and above----2.25 per year
these figures only count for the years they have been that age
examples
a person who is 22 and worked for two years would get 1.5 years redundancy, 2 x 0.75
a person who is 23 and worked for two years would get 2.25 redundancy 1 x .75 + 1 x 1.5
i can do this table manually adding on to each previous but wondered if someone might have a nice formula that would calculate it automatically
i would imagine there would have to be some kind of lookup to find out how many years they have been in each age bracket
View 9 Replies
View Related
May 8, 2009
Have a small data base with customer details and comments. I would like a form to sit over that so that people on phones can enter customer # and check info and add further comments etc. for a specific customer. Before I try and design a form is there any templates for this type of thing. Have done a Google and Ozgrid search, but I maybe asking the incorrect names for the procedure.
View 2 Replies
View Related