I want to fire up a flash presentation inside Powerpoint 2007. I am calling the Win32 ShellExecute() routine. When I run this from a location whose path is a UNC path (\myserver\myfolder\sample.ppt) it does not work.
The ShellExecute routine expects 6 arguments, one of which is the path to run it from. I've tried to set this parameter to C:\ as well as using ActivePresentation.Path (which is a UNC path). Neither works.
I initially tried this approach, but found it caused problems:
When the presentation was used from a laptop not connected to the network.
If the user did not have access to the UNC.
If the flash file was renamed, moved or deleted.
I found a better approach was to embed the file into the Powerpoint file.
It can be done as follows using Office XP, Powerpoint
From the 'View' menu select 'Toolbars' and tick the 'Control Toolbox'
On the 'Control Toolbox' toolbar click on the 'More controls' icon
A list of controls will be displayed. Scroll down until you find the 'Shockwave Flash Object' and then click on it.
This should change your cursor to a crosshair. Move to the area on the slide where you want to inset the 'Shockwave Flash Object'.
Left click, hold and drag to create a box of the required size.
Next right click on the control you have just inserted and select 'Properties'.
Set the following properties
* Autoload = True
* EmbedMovie = True
* Enabled = True
* Loop = True
* Playing = True
* Visible = True
* Movie = c:\flash.swf (Change this to the location of your .swf file)
Close the 'Properties' control
Save the file.
Close the file.
Reopen the file.
The .swf file should start playing automatically when you reach the slide during the slide show.
I found it usefull to include controls (pause/play, time line) in the .swf file
UNC paths start with a double back-slash. Are you doing that, or was that just a typo in the question?
I've resorted to mapping a drive to the UNC path.
The command line looks something like
subst A: "\\ServerName\SomeDirectory"
well, now it seems to work just fine with the unc path.
Related
I'm fairly new to using content controls and I'm designing a Word form for work. The current form has the help text for content controls hidden (I have the option enabled to display hidden controls on my computer); however, I want to make sure users of the form are able to see these controls when they open the form. The issue is that when the help text is not hidden, it prints on the form. Is there a way to set the controls so the help text does not print but it is still visible to users when they open the form?
I tried using the following code, but I ran into issues with it. The code worked on my computer, but when a coworker tested it it caused an error message to appear and I could not figure out why. The single line of code was highlighted but as the code worked on my computer, I'm not sure how to fix it (I am also very new to Visual Basic).
Sub AutoOpen()
ActiveWindow.View.ShowHiddenText = True
End Sub
I was hoping that when another user opened the document, they would see the hidden text as if it were not hidden; however, when another user opens the document, they get this error:
"Run-time error '4605':
The ShowHiddenText method or property is not available because this
command is not available for reading."
The error message is happening because Word is opening the document in the Reading rather than the Print view. That is often the case when a document is opened from email, for example.
Adding the following line before the line for hidden text should help, as it will force the document to switch to the Print Layout view:
ActiveWindow.View = wdPrintView
So
Sub AutoOpen()
Dim vw as View
Set vw= ActiveWindow.View
vw = wdPrintView
vw.ShowHiddenText = True
End Sub
I need a way to disable the ability for a user to go to (or use) the menu File > Share
I have similar for other save commands like below but need something for this feature as well
Application.CommandBars("Worksheet Menu Bar").Controls("File").Controls("Save As...").Enabled = False
Application.CommandBars("Worksheet Menu Bar").Controls("File").Controls("Save").Enabled = False
I have tried:
Application.CommandBars("Worksheet Menu Bar").Controls("File").Controls("Share").Enabled = False
to no avail
My aim is to stop users saving copies of this file (Hosted on a server), I fully understand Excel isn't meant to be secure and there is always a way to do this but want to make it as hard as I can for the average Joe
Regards
You could use a for each loop to extract the available commands:
' Iterate available commands from the file command bar.
Sub PrintAllCommandBarControlNames()
Dim cbControl As CommandBarControl
For Each cbControl In Application.CommandBars("Worksheet Menu Bar").Controls("File").Controls
Debug.Print cbControl.Caption
Next
End Sub
Run on Excel 2010, I couldn't find a share option. Might just be my system. The above returned:
&New...
&Open...
&Close
&Save
Save &As...
Single Web Page (*.mht)
Save &Workspace...
File Searc&h...
Per&mission...
Per&mission
Ch&eck Out
Ch&eck In...
Ve&rsion History...
We&b Page Preview
Page Set&up...
Prin&t Area
Print Pre&view
&Print...
Sen&d To
Propert&ies
&Recent File Name Goes Here
&Recent File Name Goes Here
Sign ou&t
E&xit Excel
The 'backstage' menu (that you get when you click top left File menu) is effectively part of the Ribbon, and not a Command Bar. If you tried disabling Save for instance, using your example, you'll find they don't work on 2010/2013 etc.
There is this answer which tells you how to manipulate those menu items in the ribbon: Remove "Save & Send" from File menu in Excel 2010 using custom XML and one of the items is called TabShare.
need to ask, I have simple app, which had one textbox and one button. When I type something to that textbox and push that button, it saves to my Settings...
see:
Dim Settings As New My.MySettings
Settings.something = TextBox2.Text
Settings.Save()
MessageBox.Show(Settings.something.ToString)
Everything works great, but when I build it and run for example from my desktop path, Enter number save it and close it. When I make a copy of this file to my documents path and open it, nothing loaded, but when I start it from the place where I last save it, it loads properly.
In the short description:
If I run app on my Desktop path and make a save, when I close the app and copy this file (.exe) to another path, I need to load previous saved data from Desktop path, or other different location.
Save in path A, copy it from and open anywhere in path B, C, D... etc.
Is it possible, if yes, how can I do that?
Thanks!
You may be looking for something like the 'SaveSetting" method
SaveSetting("MyApp", "Form1", "Text", "ValueToSave")
The first, second and third parameters indicate a "Path" where your value will be saved, and the fourth is the value itself.
Then, you can load the saved value using the following method:
MyText = GetSetting("MyApp", "Form1", "Text", "DefaultValue")
Note that the first three parameters must be the same as used on the save method, and the fourth is the default value, in case no previous data has been saved.
I'm writing a custom script for Photoshop to handle batch processing of images. I have two input folders and an output folder that I need to specify. Right now I'm using something like this to select my folders:
var inputFolder = Folder.selectDialog("Select a folder of images to process");
Because I'm working on a server with a pretty deep folder hierarchy, it can be a real pain to select through the drop-down menu that Photoshop presents to me in this dialog.
It would be so much easier to have a folder selection dialog with an address bar and quick access panel like this:
All other PS scripts that I've been digging around in use the Folder.selectDialog method to set file paths to a variable. Is there a reason for this? If not, then how can I instruct Photoshop the second style of folder navigation dialog?
It doesn't appear that Adobe supports this dialog as a folder selecting option.
There was a similar thread to this posted on the Adobe forums where a workaround was suggested:
https://forums.adobe.com/thread/1094128
The solution that was suggested is to use a saveDialog function instead of selectFolder. This gives you the folder dialog that we want, but comes with the downside of having to type a dummy name into the filename path. It also says "Save As" on the top of the dialog box, which is confusing.
Here's what was offered:
by lilsmokie on Nov 8, 2012 2:19 PM
var dskTop = Folder.desktop;
var dskPth = String(dskTop);
var newSpot = new File(dskPth+"/poop");
var selectedFolder = newSpot.saveDlg('Select Destination Folder');
var illFilePath = selectedFolder.path;
alert(illFilePath);
This opens the dialog at the desktop. Then put "poop" or whatever you
like in the text field. There the user can navigate to where ever.
When they it save illFilePath will have the folder path. Not perfect
but its close enough for me right now.
I've also discovered that I can set the starting location of the selectDialog by using selectDlg instead:
var outputFolder = Folder(app.activeDocument.path).selectDlg("Select a folder to output images to:");
This gives some control over the starting location so that the user doesn't have to click through a million dropdowns.
At the bottom of your first screenshot you can see the unput text area Folder: This PC. It works just like an address bar. You can type (or paste) something like \\server\work\folder\subfolder into this area and you get this folder ('subfolder' in this case) immediately.
On MacOS this dialog doesn't show the Folder: ... input area. But you can press Cmd-Shift-G and get the native system 'address bar' anytime.
I am working on a project where I have created a PowerPoint addin. The concept is this will only contain an user form, with a list box. Based on the user selection other modules (bas files) will be added or imported to the presentation and the code will be executed.
I don't want to include all the modules in the add in as depending upon the requirement I can do the modification and then can store in a shared folder. So every time user uses the addin they can have the updated version. So I don't have to re circulate the addin with every change.
I have a blank module where i import the code from a text file (code from bas file saved as text) and it runs.
I can import the bas files, also using inserFrom file option I can import code from a text file, but problem is it's always getting added to the current presentation code window. But I want to add the code to the addin code pane.
I have a blank module in the addin called "tempCode", where I want to update the imported code, but I am not able to do so.
It works fine when I am editing the addin as a ppt, but when I convert ppt to an addin the concept is not working.
Any ideas how I can add the code to the addin code pane rather adding to the active ppt.
Code details:
I have a user form, with a list box.
It has 3 items.
Option 1
Option 2
Option 3
If user selects any option, let's say option 2, the code for option 2 will be imported from a text file to the working module.
And a command button to run the selected.
Name of working module is “Mod_Working”
Name of text file is “C:\Code\Option2.txt”
Below is the code I am using:
Sub ImportSelected()
With ActivePresentation.VBProject.VBComponents(“Mod_Working”).CodeModule
.DeleteLines 1, .CountOfLines 'it deletes any existing code
.AddFromFile “C:\Code\Option2.txt”
End With
End Sub
Code in text file:
Sub Test
Msgbox “You selected Opt 2”
End sub
Code of Command Button:
Private Sub Cmd_run_Click()
Application.Run “Mod_Working.Test”
End Sub
This works in ppt mode but not when converted to addin.
Why not do this:
- In the shared folder, mark the add-in file as read-only (right-click, properties). This prevents the file being in-use when people are using the add-in (at least it works that way in Excel)
- When you have an update, simply replace the add-in and set it to read-only again.
Alternatively, check out: www.jkp-ads.com/articles/updateanaddin.asp