|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Using Shell with ExcelHow do I use the Shell command to open an Excel file (named "MyFile.xlsx"),
with read-only status? Any help would be appreciated. -- Russ On Jul 2, 1:20 am, BigRuss <BigR***@discussions.microsoft.com> wrote:
> How do I use the Shell command to open an Excel file (named "MyFile.xlsx"), Hi,> with read-only status? > > Any help would be appreciated. -- Russ You can apply Read-only attribute to excel file using: "System.IO.File.SetAttributes" method. ...then launch it using Process.Start to open Excel file as read-only instead of Shell as follows: ////////////// ' Get current attributes of the file Dim currentAttr As System.IO.FileAttributes = _ My.Computer.FileSystem.GetFileInfo("c:\MyFile.xlsx").Attributes ' Apply read-only attribute System.IO.File.SetAttributes("c:\MyFile.xlsx", _ IO.FileAttributes.ReadOnly Or currentAttr) ' Launch it Process.Start("c:\MyFile.xlsx") \\\\\\\\\\\\\\ Hope this helps, Onur Güzel Thank you Onur! I will give this a try.
Russ ============== Show quoteHide quote "Onur Güzel" wrote: > On Jul 2, 1:20 am, BigRuss <BigR***@discussions.microsoft.com> wrote: > > How do I use the Shell command to open an Excel file (named "MyFile.xlsx"), > > with read-only status? > > > > Any help would be appreciated. -- Russ > > Hi, > > You can apply Read-only attribute to excel file using: > > "System.IO.File.SetAttributes" method. > > ...then launch it using Process.Start to open Excel file as read-only > instead of Shell as follows: > > ////////////// > ' Get current attributes of the file > Dim currentAttr As System.IO.FileAttributes = _ > My.Computer.FileSystem.GetFileInfo("c:\MyFile.xlsx").Attributes > > ' Apply read-only attribute > System.IO.File.SetAttributes("c:\MyFile.xlsx", _ > IO.FileAttributes.ReadOnly Or currentAttr) > > ' Launch it > Process.Start("c:\MyFile.xlsx") > \\\\\\\\\\\\\\ > > Hope this helps, > > Onur Güzel >
vb.net and Ms SQL Connection ?
Using "Me" Using WPF with a "normal" windows app Unable to connect to the remote server How to reference class properties using MyClass("PropertyName") VB Net/Com Interoperability/Late Binding [XPost] - Visual Studio 2008 - Instruct IDE Not To Generate Adapter Client Server app using winsock Session Variables in asp.net DataGridView Event |
|||||||||||||||||||||||