Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-26-2018, 05:23 AM
algecan algecan is offline Editing Word documents through VBA in SharePoint Windows 10 Editing Word documents through VBA in SharePoint Office 2016
Novice
Editing Word documents through VBA in SharePoint
 
Join Date: Sep 2018
Posts: 1
algecan is on a distinguished road
Default Editing Word documents through VBA in SharePoint

I have word document with numerous command buttons on (with the VBA code for the click events being referenced in a template).
Each button has a different function but what they all pretty much share is that they will open other documents, edit them and then save/close. This all happens on our corporate network shared storage without any really intervention from the user, apart from clicking on the command button.
We are in the process of moving to a cloud-based SharePoint Solution, which means that the vba code will now have to do the above from documents stored on SharePoint and not from network storage.


I’m very new to SharePoint and I’m trying to adapt the code to work with SharePoint but I’ve hit a few issues that I just can’t seem to resolve/understand.
So far, I have been able to open, edit and save/close a document using the following

Code:
 
Dim docPath As String
docPath = ActiveDocument.Path & "/workingpaper.docx"
Documents.Open (docPath)
With Documents("workingpaper ").Tables(4)
                       .Cell(1, 1).Select
                       Selection.TypeText "test"
End With
Documents("workingpaper ").Close (wdSaveChanges)


The problem is that while the above is running, it is theoretically possible for someone to checkout the same document for editing. Therefore, I thought it would be best to check out the document in SharePoint rather than opening it, however this is where I hit a few problems.

If I use
Code:
Documents.CheckOut docPath

The document flashes up on screen and then disappears. Then, no matter how I try and reference the document I always get a bad file name error, like once it’s checked out it can no longer find it. I certainly can’t see it on screen.
As our current SharePoint solution which I am testing on is 2013 (moving to 2016 in the cloud), I understand that the document is only marked as checked out in SharePoint, rather than a local version being downloaded.

My questions is once I have checked out a document using
Code:
documents.checkout (File path)

how do I reference/call this document so that I can do something with it such as edit the contents, check it back in etc. (the check in function also fails with the bad file name error).
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Documents spontaneously become "read only" while I'm editing them Junebugsin Word 1 04-27-2018 06:39 PM
Emailed documents locked for editing by someone else jibbs Office 1 09-30-2015 05:12 AM
Editing Word documents through VBA in SharePoint Editing tables in restricted documents Help_Needed Word Tables 4 09-29-2015 05:11 PM
How to link word-documents i Sharepoint? Katarina Word 0 03-24-2014 05:55 AM
Editing Word documents through VBA in SharePoint Linking word documents in sharepoint tulip88 Word 1 04-05-2011 06:51 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:29 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft