Solved

run in administrator mode vb6

Posted on 2014-11-11
3
132 Views
Last Modified: 2014-11-19
I am trying to extrapolate data from a file using some vb6 code.  I need to be in Administrator mode when opening certain files and running this code in vb6

Private Sub Command1_Click()
Dim objMSWord As Word.Application
Dim myDoc As Word.Document
Set objMSWord = CreateObject("Word.Application")
Set myDoc = objMSWord.Documents.Open("C:\111114.txt")

For Each p In myDoc.Paragraphs
  If InStr(p.Range.Text, "BlockedIP") > 0 Then
   'Skipping - found text
  Else
    p.Range.Delete
  End If
Next

myDoc.SaveAs ("c:\Users\Me\Desktop\052214_2.txt")
myDoc.Close
Set myDoc = Nothing
objMSWord.Quit
End Sub

Open in new window


Is there a way to run this code in administrator mode?
0
Comment
Question by:al4629740
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
brendanmeyer earned 500 total points
ID: 40436676
you wil have to run the exe in administrator mode
0
 

Author Comment

by:al4629740
ID: 40436681
Is there a way for the program to prompt the exe to run in administrator mode?
0
 

Author Closing Comment

by:al4629740
ID: 40454182
Unresolved answer
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now