Det er jeg 99% sikker på at du ikke kan. Men du kan lave en lille VB-applikation, der åbner det ark du peget på, og indsætter de værdier du vil - men det er vist ikke det du er interesseret i.
Lad os se om der har den sidste 1 % - jeg er somsant ikke helt sikker på at du ikke kan
hansjacob> jacob og 23 er det dit brugernavn og bruger nummer eller hvad er det ? måske excelfilen kunne hente det via nogle API kald ved opstart af regnearket...
Det er fordi der på vores intranet ligger nogle filer med mapperygge, faneblade mv. i excel format. På samme intranetside er et register over projekter. Jeg vil gerne lave det således, at man kan klikke ind på et projekt og så klikke på en knap,hvor der står "lav mapperygge" og så popper excel op, hvor projektnavnet, nummer mv. står som det skal!
API kald er nogle standard funktioner, som kan bruges til at modtage oplysninger om pc'en styresystem og dets indstillinger. Men det løser nok ikke opgave her.
arrr jeg ved ikke rigtigt. Det er ikke min stærke side og argumentet for at gøre det på denne måde er nemlig, at vi kan benytte noget eksisterende.
Hvis der skal programmeres kan jeg ligeså godt lave en HTML/PHP side med lidt css. Men ellers tak for tilbudet ;-)
Synes godt om
Slettet bruger
12. november 2002 - 17:47#12
Hvad med bare at lave en skabelon i Excel til dine mapperygge. Du kan herefter låse skabelonen og lægge den på f.eks. et fælles drev så den er lige til at udfylde og printe ud.
Det kan nu godt lade sig gøre - se her hvad jeg fandt:
What I do is set environment variables and then read the environment variable in the Excel code:
Batch file: SET CustId="CUS0000232" C:\MyExcelLib\001.XLS
Then, in the workbook Auto_Open procedure (or in a procedure called by Auto_Open), I read the environment variables. I have a common routine to get environment variables because my application has a handful of environment variables to retrieve. Here is sample code:
Sub Auto_Open Dim CustIdParameter
CustIdParameter = Get_Environment("CustId") End Sub
Here is a copy of my function Get_Environment, which uses the API GetEnvironmentVariable (which is listed after the Get_Environment function:
Function Get_Environment(ByVal vsEnvVar As String) As String
'*********************************************************************** '* Get_Environment: '* This procedure will retrieve the value in the environment '* variable passed in vsEnvVar. '* Parameters: '* vsEnvVar: '* The name of the environment variable desired. '* Return Value: '* The value of the environment variable. '*********************************************************************** Dim SaveCurrentProcedure As String Dim EnvVarlen As Long Dim Buffer As String * 256 Dim Temp As String
Get_Environment = "" EnvVarlen = GetEnvironmentVariable(vsEnvVar, Buffer, Len(Buffer)) Temp = Left(Buffer, EnvVarlen) If Left(Temp, 1) = """" Then Temp = Right(Temp, Len(Temp) - 1) End If If Right(Temp, 1) = """" Then Temp = Left(Temp, Len(Temp) - 1) End If End Function
'*********************************************************************** '* GetEnvironmentVariable '* This is used to retrieve environment variables '*********************************************************************** Declare Function GetEnvironmentVariable Lib "kernel32" Alias "GetEnvironmentVariableA" (ByVal lpName As String, _ ByVal lpBuffer As String, ByVal nSize As Long) As Long
The following trick works at least in XL97 SR-1 / Win95. The command line arguments must be read by the Auto_open (or Workbook_Open) Sub of your add-in (say c:\temp\test.xla). Your command line should look like this one:
i.e. : after excel.exe, the name of the add-in, then the switch /e **immediately** followed by your own arguments. These arguments should be separated by "/" without any intermediate space. For instance, if you want to pass the arguments "c:\temp\file1.dbf", "all" and "exclusive" to Excel, your command-line should look like:
2. In Test.xla, use the API function GetCommandLine (alias GetCommandLineA in Win95) to get the contents of this command-line string. You should then parse the string returned by GetCommandLineA, search for the separators "/" and store each argument in an array. Here is an example of a such Auto_open sub:
'************************************************** Option Base 1 Declare Function GetCommandLineA Lib "Kernel32" () As String Dim Args() As String
Sub Auto_open()
Dim CmdLine As String Dim ArgCount As Integer Dim Pos1 As Integer, Pos2 As Integer
End Sub '**************************************************
If you use the command-line above, this Auto_open sub will store the three arguments ("c:\temp\file1.dbf", "all" and "exclusive") in the Args() array and display them.
Again, be sure that you don't insert any space between /e and each argument in the command-line, otherwise it will fail (Excel would believe that these "pseudo-arguments" are the names of workbooks to open at startup...).
hmmm. Jeg havde jo håbet på, at man kunne lave noget mere simpelt, men tak for de VB scripts.
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.