vba to open txt file on Sharepoint

Posted on 2011-02-22
Last Modified: 2012-05-11
Hi all, I have an application that opens and reads a txt file.

It works fine locally but when I try to run it on sharepoint I get Error number 75. I checked the file path and it is correct (I'm able to paste the link in a browser and see the text in the file)

Open (sHolidayfile) For Input As #1

It breaks on this line on sharepoint. Can someone help?
Question by:boukaka
  • 3
  • 3

Expert Comment

ID: 34958704
Is this file part of sharepoint or on the file system, You may want to move the file in hive folder under layouts i.e. c:\program files\common files\microsoft shared\web server extension\12 or 14 depending on which version of sharepoint you are using then template\layouts and have a folder for this file .

You can now call this file using \_layouts\foldername\filename.vbs from any of your application and it should be called

For the code to run, What is the code that you are running, Maybe its worth trying to move this to a web page code

Author Comment

ID: 34960415
I do not have access to the file system, this is a mega-corporation and getting through the red-tape and approvals process to have the file moved to the server is not feasible, that would take weeks, maybe months and I don't have time to wait.

Expert Comment

ID: 34973443
Try putting a relative url in sharePoint, not sure if you are already doing that or not, How are you calling the vbs script inside the sharepoint
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.


Author Comment

ID: 34973572
The user opens an excel spreadsheet that resides on Sharepoint. They click a button that does a bunch of stuff including opening and reading from my little txt file. Can you please explain "relative url"??

Accepted Solution

sabby447 earned 500 total points
ID: 34974922
Hunh as i understant the macro's are not supported in excel services :

if you are downloading the file to a machine and then using the excel then it will connect to local machine and not sharepoint server hard drive

Relative url : ./foldername/filename.txt inside your sharepoint and not the full url i.e. http://sitename/foldername/filename.txt

Author Closing Comment

ID: 34974953
Ok, thanks

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 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