I'm completly new at this and trouble is that I got to keep Office97 compatibility. My friends call me "Ctrl+C - Ctrl+V coder", so sorry if that's a stupid question.
I've got this timestamp event runing, but it can't put value in protected sheet. I can't turn off protection while file is shared. I found AllowEditRange VBA command, so i can put timestamp in the field, but can't protect it back. I can make workaround with hidden sheet, but it's not as tidy, as "re-protection".
ActiveSheet.Protection.AllowEditRanges.Item(1).Unprotect "Password"
Is there any way to make this line work just for 1 modification, but every time i call it? Or only for VBA modifications, and not user interface? Documentation leaves no hope. I've spent way to much time on looking it up on forums.
Related
Here is the deal, I am dealing with some really shoddy output, and no I can't correct this... it's not my data. I just have to work with it.
Here is what I want to do, because this needs to kill two birds with one stone.
I need to use VLookup to look up a ticket, once it looks up the ticket it needs to output a date. The date though is stuck between a universal "date" string...
2019-06-10T17:20:28+00:00
This string is in tab Ticket_Import in row O.
Now, I need to translate to a date that can be later sifted through and put into a chart. The only way I can figure out to do this is using DATE()
Now, here is my problem. I have figured out how to do it...mostly. I am just getting the wrong date back in return, I think it's skipping the data and just saying "Good luck jr." in it's own way...
Here is my formula:
=XLOOKUP(A1261,Ticket_Import!B:B,DATE(LEFT(Ticket_Import!O:O,4),MID(Ticket_Import!O:O,6,2),MID(Ticket_Import!O:O,8,2)),"Empty")
Now, I took this one specifically because I need the date to show up so it will be searchable, which I am not even sure if this will work or not.
The XLOOKUP is searching for the number in A1261, which is 2690.
2690's O row output is
2019-06-10T17:20:28+00:00
Now, when I use this script I wrote it shows as an end result 2019-12-31 instead of 2019-06-10
Which is telling me it can't output properly...
Can someone help me out with this and explain or show me how to get this actually working properly?
Like I said, I can't edit the raw data, but I can make the data output be whatever it needs to be to make this work... as long as I can understand it and reproduce it, because I have to do this over 4,000 more times...
Realistically, once this is done I am going to be copying and pasting the output anyway through a VBA script so that this will not be such a resource hog in the future. I am playing catch up to something that needed to be done ages ago...
Any help would be greatly appreciated.
Thanks!
Solved it...! (YAY ME!)
Ok, I know immature, but this was causing me no end of grief...
The proper code is:
=XLOOKUP(A1261,Ticket_Import!B:B,DATE(LEFT(Ticket_Import!O:O,4),MID(Ticket_Import!O:O,6,2),MID(Ticket_Import!O:O,9,2)),"Empty")
I had an improper mid alignment for the day.
Thanks for everyone that had a chance to look at and and scratch their heads for a minute or two... either way, This is also good for people to use later if they need to make it work for them as well!
I password protected my VBA Editor with:
Tools > VBAProject Properties > Protection
Clicked "Lock project for viewing"
Added a password.
What I need to have happen is that when this password prompt is accepted, It needs to run a Sub I've already written.
The answer I'm looking for and can't find in the three books on my desk is:
Is this action a Workbook Event? Or something else? And what syntax can make this happen.
Thanks!
Potential solution from MSDN:
https://msdn.microsoft.com/en-us/library/office/aa165442(v=office.10).aspx
This won't work for for what I'm trying to do. I wrote a script that asks for a key delivered weekly to authorized users via another program. What I wanted is a Sub to run which deletes all of my sensitive data if the user enters an incorrect password while attempting to get to the code.
Looks like this is not possible in Excel VBA... I'll keep learning and searching for a way to do this. If I do I will revisit this post.
I have built an application that opens an Excel Template from Access. Everything was working wonderfully until I introduced linked pictures in my Excel Templates.
The entire application which used to execute in a few seconds now takes close to a minute to do only such simple things as write data from Access to Excel.
The reason for this is that Excel gets stuck in CalculationStatus = Pending probably because I'm using volatile functions for my linked pictures (offset).
Microsoft is aware of this issue and has kindly documented it along with their "resolution" here... which is essentially nothing.
Does anyone else have an idea how to resolve or work around this issue? I have tried changing my template and not using linked pictures but these solutions don't work very well / are cumbersome.
UPDATE:
I have tried the various solutions that were proposed in the comments. None have worked yet. After having eliminated those options I am essentially at the point where I see that as long as the worksheet contains a linked picture, this bug rears its ugly head.
I'll leave the question open in case someone else does have a workaround.
My own solution for the time being is that I'll be writing code to update the relevant cells using VBA.
I tried pressing f2 to get the VBE thingo open and it just looks like jibberish to me.
I need something nice and simple which gives me a heirachy of what key words to use and where to put the dots so that I can do what I need to do and start learning this lanauge.
h = Worksheets("name_lists").range("g17").Offset(down, 0).Value
I don't know what worksheet is ? Is it a class with object range calling method offset ?
I need some sort of a resource to see what functionality is available but I can't make VBE do what I want.
Can someone please help me.
Thanks.
What you are asking for is at http://msdn.microsoft.com/en-us/library/office/ff194068(v=office.15).aspx. This should help you with documentation about individual objects and their properties/methods.
As for what functionality is available: (just about) everything you can do with the Office suite can be accessed through VBA. A good first step is to record a macro, and then try to follow the generated code. The caveat with that approach is that the recorder LOVES to use .Select and Selection., which is generally bad practice.
And, when you have a specific question you can't figure out, ask it here.
Hello everyone and greetings from Germany!
After searching for quite some time I am at my wits' end and I hope someone can help me.
I try to describe my problem as clear and briefly as possible:
I am building a MS Excel 2010 Workbook that includes several (90+) external connections to SharePoint 2013 Lists & Libraries.
These connections were created by SharePoint's integrated "Export to Excel" function (in the List/Library-Ribbon) and the connection-files were then exported to another SP farm.
(The first "source"-SP-Farm is from the customer, the second is our own intranet)
I have to refresh these connections once per day via an automated macro.
A timer-job will open the workbook at night and execute the "RefreshAllConnections"-macro,
that does a little bit more than just refreshing (such as writing the refresh date and time).
So no user is present when this happens.
And this is where my problem is:
From time to time some of those connections cannot be refreshed.
Excel displays an alert saying (translated from german):
"the following data range could not be updated: owssvr (...)
Do you wish to continue the update?
(OK) / (Cancel)
What I found out so far:
1) It's always the Library that is the problem
2) It's rather random which Library won't update and when
3) The problem fixes itself after some time (that's why I'm guessing this has something to do with the library being used/modified by someone else)
4) While a library is refusing to update, using "Export to Excel" function again will prompt an error once the new worksheet is created and the data is supposed to be filled in
Now here are the odds:
1) The alert always uses the "old/original" connection name that was already changed by me.
2) When I press OK the macro just continues in the next line, no error is thrown whatsoever
3) If I press cancel an Error 1004 occurs (which I can at least catch, so that would be okay).
And here are the probs:
Since this is happening automatically at night, there is no user sitting near by to answer these alerts. So:
1) The macro must automatically answer these alerts with "Cancel" IF they pop-up (and I have NO idea how to do that!)
2) I disable them via "Application.displayAlerts = false
HOWEVER: this will automatically answer them with the default answer, which is "OK".
This however is not throwing an error I could catch, so my macro won't now whether the update acutally worked or not.
Well that's about it. Sorry for the long post and thanks for reading.
Hopefully someone of you has an idea.
EDIT:
Could it be that the automatically by SharePoint generated connections are the problem?
(How) can I build them myself?
Well. I solved it myself.
The answer was stupidly simple:
Instead of refreshing the Connection, I now refresh the corresponding QueryTable via "ActiveSheet.ListObjects(1).QueryTable.Refresh"
If the Connection is not responding, an error is thrown that I can now catch properly.
Ugh, finally!